Snippets are short code templates that can be inserted into your code. They are used to reduce the amount of typing when writing repetitive code. The snippets are activated by writing the shortcut of the snippet and hitting Tab (Tab, Tab in Visual Studio).
The snippets folder in the ReactiveUI repository on Github contains snippets for inserting common code when using ReactiveUI. There are snippets available for Visual Studio, Visual Studio for Mac, Visual Studio Code, JetBrains Resharper and JetBrains Rider.
All the ReactiveUI snippet shortcuts start with the letters rui making them easy to find when using auto complete in your editor of choice.
Installing the snippets
You have 2 options.
- Copy the snippets in the following directory:
C:\Users\<your-username>\Documents\Visual Studio 2022\Code Snippets\Visual C#\My Code Snippets\
- Store the snippets in a folder of your choice on your computer
- Open Visual Studio
- Open the Tools menu bar item
- Click on Code Snippets Manager
- Change language to CSharp
- Click on Add
- Navigate to the folder you stored the snippets in and click on Select Folder
Visual Studio for Mac
- Store the snippet files in the following folder:
Visual Studio Code
- Copy the contents of ReactiveUI.json
- Open Visual Studio Code
- Open File menu bar item (Code on MacOS)
- Click on Preferences > User snippets
- Paste contents inside the angle brackets (
- Copy the contents of RxUI.dotsettings
- Navigate to the UserSettings.dotsettings inside your project root folder
- Paste the contents inside a
- Store the snippet file in the following folder: