We will be undergoing scheduled maintenance on May 20th, 2013 at 02:00 GMT.
Now there's another feature that's kind of a marriage of the Visual Studio Express environment and the C# programming language and that's a functionality called Code Snippets and a lot of developers just simply don't know these were there. They've never noticed them but I want you to see these things that can really save you a lot of time. For example, let's say that in this little method that I've added here called Add This, and we'll talk more about methods later. So if this doesn't make sense to you, don't worry about it and I want to put a Do Loop. Okay. A Do, Do While. Well, so now I start to think, well wait a minute now. How I exactly do I build that? And I have to go look up an example if I don't do these every day but notice if I just type Do, you will notice, right here, there is a Code Snippet for the Do While Loop. Now if I double-click this, nothing happens. Okay. And that's a little confusing from what I'm used to seeing. But I'm going to go back and I'm going to type Do and then just Tab twice and notice it has set it up for me. Now there's lots of these Code Snippets out there. For example, if I'm going to create a class, I type Class Tab twice and notice it has set this right here, up for me. So now in yellow, I just have to go back and put in the name that I want to build my class on okay? So I'll go delete that, that's not a good place. Let's see, I can create a, let me go down here and let's do this again. I'll do Class notice there's Class, double-click and I'll just call this Mark and then I want to create a Constructor, so I'm just going to do C Tour double-click and notice there's my Constructor for the class. Okay. If you know what Constructors are, a light just came on, if you don't, don't worry about it, we'll just take that right back off. So there's a lot of things I can do here for example for loops, for, let me get over here, let's see, For Loop, For 2 Tabs, there it is, very, very easy to get things happening. There's a lot of these out there, if you just go to Google and just do a search on C# Code Snippets, S N I P P E T S, and you can see these. Another popular one we like to use a lot of, Switch Statements in our coding and so if I just come up here and type Switch, 2 Tabs, there it is and it starts to lay this out for me, makes it very easy to do things. So anyway, Code Snippets are really cool, you can recognize them out there. For Example, I can type Class, you'll notice it's got this little icon here and all I have to do when I get that, is just Tab once, Tab again and there it is. So anyway, use Code Snippets, watch for them in Intellisense as you're out there looking around, and you can actually learn these as you go through coding something that's not even related. But you'll notice those little icons. So anyway that's Code Snippets. It can really save you a lot of time in your coding.
| Course: | Microsoft C# 2010 |
| Author: | Mark Long |
| SKU: | 34306 |
| ISBN: | 978-1-61866-037-4 |
| Release Date: | 2012-03-19 |
| Duration: | 8.5 hrs / 105 lessons |
| Work Files: |
Yes |
| Captions: | No |
| Compatibility: |
Vista/XP/2000, OS X, Linux QuickTime 7, Flash 8 |