The Essential C# Snippet Source...
- Posted: May 09, 2016 at 6:00AM
Last week I highlighted Josef Pihrt's great Roslyn Tools project, Roslyn Tools, Analyzers, Refactorings and source... While browsing his site I came across another great looking project from him, Snippet Essentials.
How many Snippets are talking about? 700! Yeah, no kidding, 700 C# Snippets, all free and all open source too...
Snippet Essentials is an ultimate collection of more than 700 snippets for C#.
How It Works
Snippet Essentials contains hundreds of snippets. Rather than memorizing snippets shortcuts, Snippet Essentials introduces framework that is used to construct snippet shortcut. This framework consists of single characters or character sequences where each character or character sequence represents particular language element. Please see quick reference for a list of defined character sequences.
Snippets are installed to the following directory: C:\Users\USER_NAME\AppData\Local\Microsoft\VisualStudio\VISUAL_STUDIO_VERSION\Extensions\EXTENSION_FOLDER
Snippet Essentials is distributed as Visual Studio Extension.
Snippet Essentials project is available on GitHub.
List of Selected Snippets
- !String.IsNullOrEmpty method - snne
- !String.IsNullOrWhiteSpace method - snnw
- #if #else preprocessor directives - ppife
- #if preprocessor directive - ppif
- Array type declaration - a
- Array variable declaration (with initializer) - vair
- Array variable declaration - va
- Attribute - ae
- Boolean variable declaration - vb
- Braces - b
- Break statement - bk
How active is the project? This says it all...
Snippet Essentials 0.9.4 (2016-04-30)
- new snippet: Statement.If.IfTryGetValue (iftgv)
- new snippet: Statement.If.IfNotTryGetValue (ifftgv)
- new snippet: Statement.If.IfNotAndAlso (iffaa)
- new snippet: Statement.If.IfNotOrElse (iffoo)
- new snippet: Declaration.Field.PrivateStaticReadOnlyFieldBoolean (psrfb)
- new snippet: Declaration.Field.PrivateStaticReadOnlyFieldInt32 (psrfi)
- new snippet: Declaration.Field.PrivateStaticReadOnlyFieldInt64 (psrfii)
- new snippet: Declaration.Field.PrivateStaticReadOnlyFieldString (psrfs)
Snippet Essentials 0.9.3 (2016-04-21)
- new snippet: System.Threading.Tasks.GenericTaskType (gt)
- new snippet: Member.Property.PublicReadOnlyAutoPropertyCollection (rpc)
- new snippet: Statement.If.IfEqualToNullContinue (ifnce)
- new snippet: Statement.If.IfNotEqualToNullContinue (ifnnce)
- new snippet: Miscellaneous.ObjectKeyword (o)
- snippet removed: Operator.TildeOperator (o)
- snippet removed: Operator.ExclusiveOrOperatoe (o)
Snippet Essentials 0.9.2 (2016-04-07)
- new snippet: Member.Field.PrivateReadOnlyFieldBoolean (prfb)
- new snippet: Member.Field.PrivateReadOnlyFieldInt32 (prfi)
- new snippet: Member.Field.PrivateReadOnlyFieldInt64 (prfii)
- new snippet: Member.Field.PrivateReadOnlyFieldString (prfs)
Snippet Essentials 0.9.1 (2016-03-14)
- new snippet: Miscellaneous.LambdaExpressionWithTwoParameters (l2)
Here’s a few more links you might find interesting: