1 / 14

BabulalK @ G-C-I.COM

Visual Studio 2005 Code Snippets. BabulalK @ G-C-I.COM. What the heck is this?. BabulalK @ G-C-I.COM. Code Snippets. Are blocks of code. IntelliSense Code Snippets are reusable. Task-oriented.

ilar
Download Presentation

BabulalK @ G-C-I.COM

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Visual Studio 2005 Code Snippets BabulalK @ G-C-I.COM

  2. What the heck is this? BabulalK @ G-C-I.COM

  3. Code Snippets Are blocks of code. • IntelliSense Code Snippets are reusable. • Task-oriented. Visual Studio 2005 includes code snippets covering tasks ranging from creating a custom exception, to sending an e-mail message, to drawing a circle. BabulalK @ G-C-I.COM

  4. Code Snippets Or Ctrl + K , X BabulalK @ G-C-I.COM

  5. Code Snippets – Demo 1 BabulalK @ G-C-I.COM

  6. Creating Custom Code Snippets Two Elements • <Header> • <Snippet> <Header> <Title>Singleton</Title> <Shortcut>Singleton</Shortcut> <Description>Code snippet singleton class</Description> <Author>Babulal K R</Author> <SnippetTypes> <SnippetType>Expansion</SnippetType> </SnippetTypes> </Header> BabulalK @ G-C-I.COM

  7. <Snippet> Sub-element to specify the basic code. Contains 4 sub elements like < References > -- To add assembly references. < Imports > -- To import the Namespaces. < Declarations> -- Define the variables or type. < Code> -- Info for Code generation. Continued… BabulalK @ G-C-I.COM

  8. <References> <References> <Reference> <Assembly>System.dll</Assembly> </Reference> </References> OR <References> <Reference> <Assembly>System.xml, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089 </Assembly> </Reference> </References> Demo… BabulalK @ G-C-I.COM

  9. <Imports> <Imports> <Import> <Namespace>System. Collections</Namespace> </Import> </Imports> Demo… BabulalK @ G-C-I.COM

  10. <Declarations> <Declarations> <Literal> <ID>type</ID> <ToolTip>Property type</ToolTip> <Default>String</Default> </Literal> <Literal> <ID>property</ID> <ToolTip>Property name</ToolTip> <Default>MyProperty</Default> </Literal> <Literal> <ID>field</ID> <ToolTip>The variable backing this property</ToolTip> <Default>_myPropertyr</Default> </Literal> </Declarations> Demo… BabulalK @ G-C-I.COM

  11. <Code> • Language supported • CSharp • VB • VJSharp • XML <CodeLanguage="CSharp"> <![CDATA[private $type$ $field$; public $type$ $property$ { get { return $field$;} set { $field$ = value;} } $end$]]> </Code> BabulalK @ G-C-I.COM

  12. Demo BabulalK @ G-C-I.COM

  13. Q & A BabulalK @ G-C-I.COM

  14. More reading… • http://msdn2.microsoft.com/en-us/library/9ybhaktf(VS.80).aspx. • http://msdn2.microsoft.com/en-us/vstudio/aa718338.aspx • http://www.developer.com/net/vb/article.php/10926_3505156_1 • http://dotnetjunkies.com/Article/C95AC204-DE44-4D4A-A2B7-1EB1BE14A8A1.dcik And of-course in my blog http://bazu.wordpress.com BabulalK @ G-C-I.COM

More Related