Google Search

Google
 

Thursday, July 24, 2008

Video: Code Expansions and Code Snippets

Presenter:Mike Taulty

Code Expansions and Code Snippets

The following text is a software generated transcript of the video. Click on a minute link to jump to a location within the video


Minute 0

Hello and welcome to the Scotland and it s certainly one in a series of short sessions were reluctantly in interesting technologies in and around the net framework and visual studio life might Tolkien I work in the developer and platform group in Microsoft in the UK and in this particular session actors wanted a quick look at the features we have in visual studio 25 around code snippets and at what she chuckles expansions son working here with visual studio 2005 beta one refresh which you can get from MSDN subscriber downloads to that switch later with our environment and have a look at what we can do with code expansions and code snippets so don t snippets and expansions are a purely a productivity featuring IDE the idea is to save typing in in a really nice son and a quite fancy way such a visual studio and were just first throw and megaprojects must make a seizure project in the first instance

Minute 1

Amadis have a console applications that have something to do so later a sea shop Roddick there and will ultimately be projects lets go ahead and into the solution lets out a new project and is one of the big project and will have a Consul application again Tamagotchi projects at as those of his winners from second to hanging off my tools menu in visual studio gears and new eyes and call the code snippets manager CID of their sister manager bunch of snippets of code that you constantly renews iron and consequently constantly retype and level yourself typing after a while so the curtain of its manager is managing bunches of a snippet of code across languages so you can see at the moment I ve got some VB snippets I doesn t be seashell snippets I ve also got a section of the visual Joe shot it now in the

Minute 2

Here and in seashell these things on their surface themselves slightly gratefully so that Outlook I have actually happened ago over two and seashell first to look at how has happens here so if these are seashell code and the way they snippets surface here even I can use the right mouse menu and Intel assents and I can insert what seashell editor calls and expansion and if you look at that level what you see is that this gives me a list and is corresponds to the snippets that must eat these manager has the seashell of things that I can insert if I wanted to for instance insert back at lock and you ll see that turn the editor inserts for me and indeed it ran out of intelligence at this point because it knows of this it s got to be an something to do with the exception that even give me filtered in Tallis and is only listing a exception types here so we re all co star in front of expansions that can be inserted of that right now is menu so we ve got

Minute 3

Agency say wanted to do her something like a switch statement we can in certain does that for as long to insert something like jam at scroll down to is unlikely to fall it can insert that for as and chances are that you wouldn t normally insert these things this way from England to the mass man you bear each snippet or expansion that we got there also has a shortcut associated with diverse as if I want to define a property on my class there is an expansion of the bands I can just type the word prop press and you see the insidiously as a template of snippet of filling so if I wanted to have some kind of name property then I can just type in like that s all I m doing in that instance is to take that back out with this research is that in all the dangerous driving prop to have strange town on the bar name tag name

Minute 4

To run their that you get the idea and so normally what you accompanied it is is use the keyboard threatened to get wanted her to fall it would miss out for J town town and were done so is very nice way of fun of getting a piece of code inserted for as little edit them shows his office he shall visit to select a piece of code and we can also do surround with sets around with sales what you want to wrap around this coat if I wanted to try catch then you can see that we have wrapped that flycatcher and that existing is a code to message there and if we closest I ve ever second and switchover to VB bene VB code using a very similar feature is here in the DVD what we can do is we can insert a snippet as a postal expansion to rethink the insert snippet and all the registered snippets that we got with a snippet manager for the Asia

Minute 5

Up to say we wanted to do something like am I then have met without subsidy something that the network and we wanted to send an e mail message that was the code for the creating of sending an e mail message lets go for sending an e mail message I can assert that snippet you can see that it s parameterised so I study my server named as town only to type in town the name of the person who s getting the mail person is returning in ourselves discount through the translated parts but that piece of code strategy the work is is provided fully by the separate and again we got some small service that I wanted to do something like can perhaps look at drives and folders that I wanted to do something I can retrieve all the drive named on a local machine and just picked the wrong one that is so the right one

Minute 6

Driver in the local computer and it is a vicious rows in the Psycho to do that for me with system I have noticed that also brings in theis forming and is a right cigarette import statements for me as well so the most important thing to say but this is as a whole bunch of them here in the first beta that probably a month more in the next beta but regardless of that you can add your own sofa go back to deselect him out of the second outlook at Smith manager dialog you ll see the regardless of language selects as the VB if that is the way these things are being stored through a popular looking than Explorer you can see that down here in a folder hierarchy will regard as it is a bunch of snippets of the fiscal on them are yet to be the folders above there and then particular one that we just looked at around a doing file system work

Minute 7

You can see that in here are all the snippets are just some of the dialogue and if he wanted to get the yen to drive information machine then this is the snippet that we just looked at every perhaps do to go and opened us up in no pound estate look at it is that no part of the step up into the right folder and get all the documents in a folder but opened that particular one notepad on screen maximised your say that the way that this person it is implemented he is just through an XML file so it has this code snippet scheme you can see that there is a description you can see that there are the important references that need to be added to the project and the importantly to be added to the project in order to make this work seek and see where that comes from an agency the code itself and here is the actual piece of code that gets inserted when you use the snippet so in the same way as

Minute 8

This method already exists clearly you can go and add your own snippets and just by creating similar XML files deficit courtesy shall see how does expansions are being done then again we can get the folder where these expansions store that s just white that that copy it must drop into Explorer have a look at what s in that folder and you can see that here all the expansion to see shops of his time these adjustment xml extension and I think one of the ones that we looked at particularly was around properties at his property hopes his property expansion that is a notepad agency dedicated that at the same scheme forms we have a close look at is the title there s this neat keyboard shortcut that you type in order to get the expansion as he considers is registered as an expansion here and you can see how V particular templated pieces roughly being uncertainties who can say that we

Minute 9

Have some kind of little kids or difficult tie sums of the little local properties some sort of little coalfield and if you look at the way that the code actually works you can see that it s using these as variables type field are tight and property and again feel the field to can see how these are being parameterised effectively in order that you can have a section of code that isn t just static but has a dynamic aspect to the person filled in by filling in those yellow sections on screen so whether you re a DVD already working into sharp coated that manages managing a stuff for you and the mechanism of adding the road is the same as where you go through adding one of the effects of files into the tool distance dialogue and then and you re in business so what have we seen in this shortsightedly seemly snippet manager in

Minute 10

Survive and how that spans across languages we see her feature services in seashell code is Jones and our services in the gears code snippets I also had a quick look at how you can have your own snippets and just by adding that XML files into the various folders and adding them to visual studio are highly extensible system and if you ve got your own patterns for data access and sellers of a new cabinet and a visual studio so if you want more information on this kind of stuff visual studio 2005 has its own MSDN developer Centre you can see the link on screen if he were to search your favourite search engine for Intel assents code snippets you ll find a nice article in a sexually MSDN library that is devoted to this at topic and finally she wanted to follow concession directly then feel free to drop me an e mail and my addresses are on screen other than that thank you very much listening under and catching

Click here to go to original video page

No comments: