Ultimate C# Masterclass - Code snippets
This document is a part of “Ultimate C# Masterclass” Udemy course:
https://www.udemy.com/course/ultimate-csharp-masterclass/?
referralCode=43763BBDA97D7D0B571A
The complete list of code snippets can be found here:
https://learn.microsoft.com/en-us/visualstudio/ide/visual-csharp-
code-snippets?view=vs-2022
To use a code snippet, we must write it (for example, “cw”) and then
press Tab twice.
Here are the most useful code snippets:
● cw - Creates a call to Console.WriteLine
● ctor - Creates a constructor for the containing class
● prop - Creates an auto-implemented property declaration
● propfull - Creates a property declaration with get and set
accessors
● propg - Creates a read-only auto-implemented property with a
private set accessor
● class - Creates a class declaration
● struct - Creates a struct declaration
● enum - Creates an enum declaration
● do - Creates a do-while loop
● while - Creates a while loop
● for - Creates a for loop
● foreach - Creates a foreach loop
● if - Creates an if block
● else - Creates an else block
● switch - Creates a switch block
● try - Creates a try-catch block
● tryf - Creates a try-catch-finally block
● indexer - Creates an indexer declaration
● equals - Creates a method declaration that overrides the
Equals method defined in the Object class
● attribute - Creates a declaration for a class that derives from
Attribute
● exception - Creates a declaration for a class that derives from
Exception