VSCode Snippets for C#

snippets

In VSCode Open: File -> Preferences -> User Snippets -> C#

Pase the csharp.json

Examples:

prefix: console-write-line

Console.WriteLine($"text");

prefix: record

public record RecordName(string PropertyName);

prefix: copy-record

var newRecord = oldRecordName with { Prop = "NewValue" };

prefix: async-enumerable

private static async IAsyncEnumerable<string> GetData()
{
    foreach (var item in items)
        yield return item;
}

prefix: dictionary

Dictionary<string, string> dict = new();