0% found this document useful (0 votes)
50 views2 pages

Ultimate C# Masterclass - Useful Code Snippets

This document lists useful C# code snippets for Visual Studio including snippets for Console.WriteLine, constructors, properties, classes, loops, conditionals, exceptions and more. To use a snippet, type its name and press Tab twice.

Uploaded by

a49502462
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
50 views2 pages

Ultimate C# Masterclass - Useful Code Snippets

This document lists useful C# code snippets for Visual Studio including snippets for Console.WriteLine, constructors, properties, classes, loops, conditionals, exceptions and more. To use a snippet, type its name and press Tab twice.

Uploaded by

a49502462
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

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

You might also like