{"id":123,"date":"2014-08-06T10:32:38","date_gmt":"2014-08-06T10:32:38","guid":{"rendered":"http:\/\/mairwa.com\/wordpress\/?p=123"},"modified":"2014-08-06T10:32:38","modified_gmt":"2014-08-06T10:32:38","slug":"visual-c-code-snippets","status":"publish","type":"post","link":"http:\/\/mairwa.com\/wordpress\/?p=123","title":{"rendered":"Visual C# Code Snippets"},"content":{"rendered":"<p><a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/z41h7fat.aspx\">Link \u00a0<\/a><\/p>\n<p>&nbsp;<\/p>\n<p>By default the following code snippets are included in Visual Studio.<\/p>\n<table width=\"558\" border=\"1\" cellspacing=\"0\" cellpadding=\"0\">\n<tbody>\n<tr>\n<td width=\"106\"><b>Name (or shortcut)<\/b><\/td>\n<td width=\"224\"><b>Description<\/b><\/td>\n<td width=\"228\"><b>Valid locations to insert snippet<\/b><\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"106\">#if<\/td>\n<td valign=\"top\" width=\"224\">Creates a\u00a0#if\u00a0directive and a\u00a0#endif\u00a0directive.<\/td>\n<td valign=\"top\" width=\"228\">Anywhere.<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"106\">#region<\/td>\n<td valign=\"top\" width=\"224\">Creates a\u00a0#region\u00a0directive and a\u00a0#endregion\u00a0directive.<\/td>\n<td valign=\"top\" width=\"228\">Anywhere.<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"106\">~<\/td>\n<td valign=\"top\" width=\"224\">Creates a destructor for the containing class.<\/td>\n<td valign=\"top\" width=\"228\">Inside a class.<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"106\">attribute<\/td>\n<td valign=\"top\" width=\"224\">Creates a declaration for a class that derives from\u00a0Attribute.<\/td>\n<td valign=\"top\" width=\"228\">Inside a namespace (including the global namespace), a class, or a struct.<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"106\">checked<\/td>\n<td valign=\"top\" width=\"224\">Creates a\u00a0checked\u00a0block.<\/td>\n<td valign=\"top\" width=\"228\">Inside a method, an indexer, a property accessor, or an event accessor.<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"106\">class<\/td>\n<td valign=\"top\" width=\"224\">Creates a class declaration.<\/td>\n<td valign=\"top\" width=\"228\">Inside a namespace (including the global namespace), a class, or a struct.<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"106\">ctor<\/td>\n<td valign=\"top\" width=\"224\">Creates a constructor for the containing class.<\/td>\n<td valign=\"top\" width=\"228\">Inside a class.<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"106\">cw<\/td>\n<td valign=\"top\" width=\"224\">Creates a call to\u00a0WriteLine.<\/td>\n<td valign=\"top\" width=\"228\">Inside a method, an indexer, a property accessor, or an event accessor.<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"106\">do<\/td>\n<td valign=\"top\" width=\"224\">Creates a\u00a0do\u00a0<b>while<\/b>\u00a0loop.<\/td>\n<td valign=\"top\" width=\"228\">Inside a method, an indexer, a property accessor, or an event accessor.<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"106\">else<\/td>\n<td valign=\"top\" width=\"224\">Creates an\u00a0else\u00a0block.<\/td>\n<td valign=\"top\" width=\"228\">Inside a method, an indexer, a property accessor, or an event accessor.<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"106\">enum<\/td>\n<td valign=\"top\" width=\"224\">Creates an\u00a0enum\u00a0declaration.<\/td>\n<td valign=\"top\" width=\"228\">Inside a namespace (including the global namespace), a class, or a struct.<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"106\">equals<\/td>\n<td valign=\"top\" width=\"224\">Creates a method declaration that overrides the\u00a0Equals\u00a0method defined in theObject\u00a0class.<\/td>\n<td valign=\"top\" width=\"228\">Inside a class or a struct.<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"106\">exception<\/td>\n<td valign=\"top\" width=\"224\">Creates a declaration for a class that derives from an exception (Exception\u00a0by default).<\/td>\n<td valign=\"top\" width=\"228\">Inside a namespace (including the global namespace), a class, or a struct.<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"106\">for<\/td>\n<td valign=\"top\" width=\"224\">Creates a\u00a0for\u00a0loop.<\/td>\n<td valign=\"top\" width=\"228\">Inside a method, an indexer, a property accessor, or an event accessor.<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"106\">foreach<\/td>\n<td valign=\"top\" width=\"224\">Creates a\u00a0foreach\u00a0loop.<\/td>\n<td valign=\"top\" width=\"228\">Inside a method, an indexer, a property accessor, or an event accessor.<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"106\">forr<\/td>\n<td valign=\"top\" width=\"224\">Creates a\u00a0for\u00a0loop that decrements the loop variable after each iteration.<\/td>\n<td valign=\"top\" width=\"228\">Inside a method, an indexer, a property accessor, or an event accessor.<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"106\">if<\/td>\n<td valign=\"top\" width=\"224\">Creates an\u00a0if\u00a0block.<\/td>\n<td valign=\"top\" width=\"228\">Inside a method, an indexer, a property accessor, or an event accessor.<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"106\">indexer<\/td>\n<td valign=\"top\" width=\"224\">Creates an indexer declaration.<\/td>\n<td valign=\"top\" width=\"228\">Inside a class or a struct.<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"106\">interface<\/td>\n<td valign=\"top\" width=\"224\">Creates an\u00a0interface\u00a0declaration.<\/td>\n<td valign=\"top\" width=\"228\">Inside a namespace (including the global namespace), a class, or a struct.<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"106\">invoke<\/td>\n<td valign=\"top\" width=\"224\">Creates a block that safely invokes an event.<\/td>\n<td valign=\"top\" width=\"228\">Inside a method, an indexer, a property accessor, or an event accessor.<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"106\">iterator<\/td>\n<td valign=\"top\" width=\"224\">Creates an iterator.<\/td>\n<td valign=\"top\" width=\"228\">Inside a class or a struct.<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"106\">iterindex<\/td>\n<td valign=\"top\" width=\"224\">Creates a &#8220;named&#8221; iterator and indexer pair by using a nested class.<\/td>\n<td valign=\"top\" width=\"228\">Inside a class or a struct.<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"106\">lock<\/td>\n<td valign=\"top\" width=\"224\">Creates a\u00a0lock\u00a0block.<\/td>\n<td valign=\"top\" width=\"228\">Inside a method, an indexer, a property accessor, or an event accessor.<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"106\">mbox<\/td>\n<td valign=\"top\" width=\"224\">Creates a call to\u00a0MessageBox.Show. You may have to add a reference to System.Windows.Forms.dll.<\/td>\n<td valign=\"top\" width=\"228\">Inside a method, an indexer, a property accessor, or an event accessor.<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"106\">namespace<\/td>\n<td valign=\"top\" width=\"224\">Creates a\u00a0namespace\u00a0declaration.<\/td>\n<td valign=\"top\" width=\"228\">Inside a namespace (including the global namespace).<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"106\">prop<\/td>\n<td valign=\"top\" width=\"224\">Creates an\u00a0auto-implemented property\u00a0declaration.<\/td>\n<td valign=\"top\" width=\"228\">Inside a class or a struct.<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"106\">propfull<\/td>\n<td valign=\"top\" width=\"224\">Creates a property declaration with get and set accessors.<\/td>\n<td valign=\"top\" width=\"228\">Inside a class or a struct.<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"106\">propg<\/td>\n<td valign=\"top\" width=\"224\">Creates a read-only\u00a0auto-implemented property\u00a0with a private &#8220;set&#8221; accessor.<\/td>\n<td valign=\"top\" width=\"228\">Inside a class or a struct.<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"106\">sim<\/td>\n<td valign=\"top\" width=\"224\">Creates a\u00a0static\u00a0int\u00a0Main method declaration.<\/td>\n<td valign=\"top\" width=\"228\">Inside a class or a struct.<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"106\">struct<\/td>\n<td valign=\"top\" width=\"224\">Creates a\u00a0struct\u00a0declaration.<\/td>\n<td valign=\"top\" width=\"228\">Inside a namespace (including the global namespace), a class, or a struct.<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"106\">svm<\/td>\n<td valign=\"top\" width=\"224\">Creates a\u00a0static\u00a0void\u00a0Main method declaration.<\/td>\n<td valign=\"top\" width=\"228\">Inside a class or a struct.<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"106\">switch<\/td>\n<td valign=\"top\" width=\"224\">Creates a\u00a0switch\u00a0block.<\/td>\n<td valign=\"top\" width=\"228\">Inside a method, an indexer, a property accessor, or an event accessor.<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"106\">try<\/td>\n<td valign=\"top\" width=\"224\">Creates a\u00a0try-catch\u00a0block.<\/td>\n<td valign=\"top\" width=\"228\">Inside a method, an indexer, a property accessor, or an event accessor.<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"106\">tryf<\/td>\n<td valign=\"top\" width=\"224\">Creates a\u00a0try-finally\u00a0block.<\/td>\n<td valign=\"top\" width=\"228\">Inside a method, an indexer, a property accessor, or an event accessor.<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"106\">unchecked<\/td>\n<td valign=\"top\" width=\"224\">Creates an\u00a0unchecked\u00a0block.<\/td>\n<td valign=\"top\" width=\"228\">Inside a method, an indexer, a property accessor, or an event accessor.<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"106\">unsafe<\/td>\n<td valign=\"top\" width=\"224\">Creates an\u00a0unsafe\u00a0block.<\/td>\n<td valign=\"top\" width=\"228\">Inside a method, an indexer, a property accessor, or an event accessor.<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"106\">using<\/td>\n<td valign=\"top\" width=\"224\">Creates a\u00a0using\u00a0directive.<\/td>\n<td valign=\"top\" width=\"228\">Inside a namespace (including the global namespace).<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"106\">while<\/td>\n<td valign=\"top\" width=\"224\">Creates a\u00a0while\u00a0loop.<\/td>\n<td valign=\"top\" width=\"228\">Inside a method, an indexer, a property accessor, or an event accessor.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n","protected":false},"excerpt":{"rendered":"<p class=\"excerpt\">Link \u00a0 &nbsp; By default the following code snippets are included in Visual Studio. Name (or shortcut) Description Valid locations to insert snippet #if Creates a\u00a0#if\u00a0directive and a\u00a0#endif\u00a0directive. Anywhere. #region Creates a\u00a0#region\u00a0directive and a\u00a0#endregion\u00a0directive. Anywhere. ~ Creates a destructor for the containing class. Inside a class. attribute Creates a declaration for a class that derives from\u00a0Attribute. Inside a namespace (including&hellip; <a href=\"http:\/\/mairwa.com\/wordpress\/?p=123\">Read more &rarr;<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-123","post","type-post","status-publish","format-standard","hentry","category-c-vb","xfolkentry"],"_links":{"self":[{"href":"http:\/\/mairwa.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/123","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/mairwa.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/mairwa.com\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/mairwa.com\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/mairwa.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=123"}],"version-history":[{"count":0,"href":"http:\/\/mairwa.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/123\/revisions"}],"wp:attachment":[{"href":"http:\/\/mairwa.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=123"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/mairwa.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=123"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/mairwa.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=123"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}