Skip to content

Latest commit

 

History

History
23 lines (17 loc) · 1.17 KB

File metadata and controls

23 lines (17 loc) · 1.17 KB

Strong typing code snippets for Visual Studio Code

Here code snippets can be found for:

  • A strong type wrapping a string [short-cut: strongstr]
  • A strong type wrapping a value type [short-cut: strongval]
  • A comparable strong type wrapping a string [short-cut: cmpstrongstr]
  • A comparable strong type wrapping a value type [short-cut: cmpstrongval]

The "comparable" types differ from the non-comparable types in that they implement IComparable<> and IComparable as well as IEquatable<>.

By default the name for the type generated will be the name of the file. Unfortunately, there is currently no means of removing the extension so you'll need to remove the .cs manually. Once this vscode issue has been resolved and released, this behaviour will be corrected.

Installation

In Visual Studio Code go to File -> Preferences -> User Snippets and select C# from the list of languages. This will open csharp.json for editing. Next paste the contents of strong_types.json into that file and save it. You should now be able to access the code snippets in a C# file via the short-cuts named above.