 Hello everybody and thank you so much for joining me here today. My name is Cody Byer, Program Manager on the Visual Studio for Mac team here at Microsoft. Today, we're going to talk about snippets. Snippets are a feature of the IDE that allow you to quickly add blocks of code to your source without having to type in the entire block. For example, if you want to add an if statement, simply type if hit tab twice and if statement will expand, allowing you to fill in the details from there. I'm going to take a look at this source file right here. As I mentioned, if statements are one of the many powerful snippets available in VS for Mac. Others include for loops, for each loops, and while statements. As you can see with each of these, when I type in the snippet and hit tab twice, I am provided cursors in the areas where I need to add information. For example, here I have int i, i is less than max and i plus plus. Within these areas, I'm able to type in what variables I need to use here. For example, if I need i to be less than 20, all I need to do is type in 20 and this gives me the for loop that I require. Another powerful aspect of this feature is that you can add custom snippets that match what your team needs. To do this, open up Visual Studio Preferences, and navigate to the snippet section, which you can find under the text editor. Here you're given a powerful editor to add or edit snippets that are available. Let's first add one. To do so, simply click Add, and you're provided with a snippets add screen. Here, you can type in details of your snippets such as the shortcut you want to use, as well as what type of file the snippet will be used in. So, I'm going to add a snippet that says Hello World. So, my shortcut is going to be Hello, the group is going to be C-sharp, the description is going to be Hello World, and the MIME is going to be Text C-sharp. Here, I can type in the template text. For example, console.writeLine, Hello World. Now, I'm going to click OK to save this snippet. Let's go back to our source file and see if that snippet works. Now that we've added the snippet, you can execute it by typing in the keyword that you set when you created it. In our case, keyword was Hello. So, by typing in Hello and hitting tab twice, that expands out to include Hello World. You can also edit snippets in Visual Studio for Mac to either make them more specific to your needs or more powerful. To do this, again, open the Preferences dialog and navigate to the Code Snippets section. I'm going to edit another custom snippet that I made previously on using statements. To do this, I'm going to click Edit, and again, I'm given a code editing dialog. You may notice some differences in this statement from the Hello World one we made previously. The biggest standout is the use of variables. Here, you can see that strings, surrounded by dollar signs, represent variables that you must change when you use the snippet. For example, the value variable here must be the name of the item which you're going to be using. One thing I've noticed is that I'm missing the ending parentheses within my new value section. So, I'm going to add these parentheses here and simply click Okay, and again, click Okay to save it. So, now that we've edited our snippet, let's see if it works. I'm going to type in using and tab again. Perfect. My snippet expands and provides me areas where I can type in all the things I need to change. Now, I'm going to make a using statement using the list. So, I'm going to type in list string. As you can see, not only did the left side of the declaration change, but so did the right side, as those are both the same variable when I created the snippet. So, now the only thing that's left is to name my list. So, I'm going to hop into the not set section, and name my list cats. As you can see, it not only change the name of the declaration, but also change the name of the value within the using statement itself. Let's see again how we did that. So, open up preferences and go to the using section. You can see that I use two variables, value and name. By using the same variable in multiple places, I ensure that any changes I make to one is reflected in the other. If you expand this out further, you can make very powerful snippets that can really make it easier to reuse specific blocks of code. Today, we learn not only how to use existing snippets in Visual Studio for Mac, but also how to create your own snippets that can be used in a custom environment. To learn more about Visual Studio for Mac, please visit aka.ms slash vsmacdocs, or stay tuned for the next video in our series. Thank you.