Creating and Consuming Custom Code Snippets
Code snippets .snippet files are XML files containing the code and information about the snippet. Code snippets have their own XML schema that Visual Studio then uses to correctly identify them within the IDE. To understand how a code snippet is made, consider the following code that is stored in the snippet named Calculate Cosine of an Angle from the Visual Studio snippets library:
Dim radians As Double = 120 * Math.PI / 180Dim cos As Double = Math.Cos(radians)
If you open the CalculateCosineOfAngle.snippet file with an XML editor (or just with Windows Notepad), the file content looks like the content of Listing 52.1.
Get Visual Basic 2015 Unleashed now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.