I am so, so late to the code snippet party and I feel like I’ve wasted my youth @iwritecodesmtms
I recently discovered the power of Code Snippets in Visual Studio. They’re super easy to make and can save you a ton of typing for repetitive tasks. This is a brief guide on making a new snippet in VS for Mac.
Simply click the Visual Studio menu and select preferences. Then, scroll down to snippets to view a list of pre-made and custom snippets, where you’ll get a preview of the snippet output and a short description.
Add or Edit a snippet to get the detailed view, where you can tailor the snippet to your needs.
Any variable defined by the $ can then be configured in the right hand menu to have defaults that you set.
To export or import gists, simply copy files to and from ~Library/VisualStudio/<version>/Snippets (at the time of writing, <version> was 7.0 – even though I am on a higher “minor” build of VS Mac)
You can find a few of the snippets I’ve created already over in my gist. Shout out to Hussain Abbasi of IntelliAbb who posted a few weeks back and opened my eyes to the wonderful world of snippets. His blog post has a huge swath of useful snippets for Xamarin.Forms and beyond!