Snippet Search:
enter some search text and choose a language to search for a specific snippet
or browse:

 TitleAbstractAuthor
1137VBCopy a File TesteClovis Rodrigues
1136csharpDispose patternA common design pattern for implementing IDisposable. This snippet expands into three methods: 1. A destructor for your class. 2. A public Dispose() method. 3. A private Dispose() method called by 1 & 2.Tim Long
1135csharpSqlDataReaderCreates a using block for a given SqlCommand and opens a while loop on SqlDataReader.Read() for that Command.Stefan Baumgartner
1134CSharpthrow new NotImplementedExceptionthrni -> throw new NotImplementedException("");
1133CSharpthrow new ApplicationExceptionthra -> throw new ApplicationException("");
1132CSharpthrow newthr -> throw new
1131XMLSilverlight clientaccespolicy.xmlTemplate for creating a clientaccesspolicy.xml for use in Silverlight cross domain enabling web services.Tim Heuer
1130CSharp Constrain a variable to a range. Rather that using the potentially slow Math.Max(Math.Min()) rather use a ternary if operator.
1129VBSave Window Size SettingsSaves a windows size to settings if the window is a normal state.Andrew Jackson
1128VBSave Window Location SettingsSaves a windows location to settings if the window is a normal state.Andrew Jackson
1127VBLoad Window Size SettingsLoads a windows previous size from settings, checking for first use and using design default if not specified.Andrew Jackson
1126VBLoad Window Location SettingsLoads a windows previous location from settings, checking for first use and using design default if not specified.Andrew Jackson
1125VBAuto Upgrade SettingsAuto Upgrade the settings from a previous version if it exists.Andrew Jackson
1124VBInsert Wait Cursor Block DefaultInserts a block of code setting the cursor to wait, then default.Andrew Jackson
1123VBInsert Wait Cursor Block remembering the previous cursorInserts a block of code setting the cursor to wait, then revert to the previous cursor.Andrew Jackson
1122csharpTernary OperatorInsert a template Ternary operator in the format (Condition ? true : false); Shortcut is TernaryAndrew Jackson
1121VBBugsTrace.callThis snippet inserts the BugsTrace.call statement. Locate it wherever you want to trace program flow or critical variable values, in place of comments. See BugsTrace.doc.snippet for instructions. Paul Noeldner
1120VBBugsTrace.functionThis is part of a 3 snippet set: bugstrace.doc.snippet, bugstrace.call.snippet, and bugstrace.function.snippetPaul Noeldner
1119VBBugsTrace.functionThis is part of a 3 snippet set: bugstrace.doc.snippet, bugstrace.call.snippet, and bugstrace.function.snippetPaul Noeldner
1118VBBugsTrace.docBugsTrace provides a very lightweight, easily deployed developer message trace capability that is not dependent on the application, language, framework, or runtime tools for use. Instant BugsTraces can contribute greatly to rapid development, testing, and debugging. The BugsTrace output only has trace statements and information the developer wanted to include, making it much more easily readable for rapid testing and debugging. I wrote the BASIC version in the 1980's and have reused it in many different languages and environments including VB, C, C#, PHP, Ruby and COBOL. All work the same using a simple text file as the trace toggle and trace content. System security controls read and write access. The code can be customized but that is not required. It can stay in the application throughout it's life cycle and deployment contexts with very negligible performance impact. For VB 2005, there are 3 snippet files: bugstrace.call, bugstrace.method, and bugstrace.doc. Enjoy!Paul Noeldner
1117CSharpDeclare EventDefine an event with generic eventhandler. Only provide public add and remove methods
1116CSharp Property_declaration Property declare template
1115CSharp Custom_event_args_class Custom Event Args template
1114CSharpQueryString PropertyA QueryString (as in GET parameter) Property with replaceables for type, property name, and GET parameter. More info: http://www2.john.rummellcc.com/2007/05/querystring-property-c-code-snippet.htmlJohn Rummell
1113csharpResize an ImageReSize an Image
1112csharpoperator ==operator == snippetDmitry Garaev
1111csharpAssertion2Assertion with exception that allows you to include a variable's value in the error messageJames Blasius
1110csharpAssertion1Assertion/Exception combination inspired by Debugging .Net 2.0 ApplicationsJames Blasius
1109csharpternayInsert ternary (single line compact conditional) operatorBrad Wood
1108csharppropStringLazyLazy load of a string from the app.config file with a backing field and a default value (string.Empty if not specified).Anton Delsink
1107csharppropTypedLazyLazy load of a value type property from the app.config file; has backing field and default value and initializes with the value type's default value if none is specified.Anton Delsink
1106VBCount the Words in a Text StringCount the words in a text string where a word is assumed to be delimited by spaces.Dan Mabbutt
1105csharppropAmdLazyLazy load property from AppSettings in .config with a default value and backing fields.Anton Delsink
1104VBProperty With RegionThis is the VB.NET version of Mike Palermo's Property with Region code snippet. Original from the Great Jennifer C with a slight modification!Samson Loo
1103csharpViewState PropertyGenerates property that is stored in the ViewState bag of an ASP.NET control or page. More info here: http://blogs.vizibility.net/sdobrev/archive/2006/09/30/Code-Snippets-Returned.aspxStefan Dobrev
1102csharpIf Item or AlternatingItemChecks whether the item type is item or alternating item. More info here: http://blogs.vizibility.net/sdobrev/archive/2006/09/30/Code-Snippets-Returned.aspx Stefan Dobrev
1101csharpWeb Control EventGenerates event that can be used in ASP.NET control or page. More info here: http://blogs.vizibility.net/sdobrev/archive/2006/09/30/Code-Snippets-Returned.aspxStefan Dobrev
1100csharpEvent Log HelperEvent Log helper. Code to write to the event logDoron Grinstein
1099csharphacetodoThis snippet creates all you need to start to program your class. It creates a namespace, a class, four private fields and a public property for each field, a void constructor and a constructor that receives a parameter to initialize each field. The names, types and visibility are custom.Roberto Linares
1098csharpSingletonThis snippets creates a Singleton Class, as a result of the discussion happened on this post of mine: http://blogs.ugidotnet.org/piyo/archive/2005/09/14/Singleton_C_NET.aspxSimone Chiaretta
1097csharpSnippetFile1calc
1096csharpforNested for loop. with row and column structure. Simple. Prithvi Tomer
1095csharpvalnullUpdated 'valnull' This snippet validates an argument in a method and checks for null. It throws a ArgumentNullException.
1094csharp valnull ValNull This snippet checks if an argument is null. It allows you to enter the argument name and the method name.
1092csharpmboxtest
1091VBSQLHelperEjemplo Integración SQL Server y CLR Funciones LPAD y RPAD en SQL ServerRolando Escobar
1090csharp Method with Region Create a C# method wrapped in a named region.Steve Rock
1089VBProperty With RegionThis is the VB.NET version of Mike Palermo's Property with Region code snippet.Jennifer Campion
1088csharpAsyncEventBasedPatternImplementing the Event-based Asynchronous Pattern without supports multiple concurrent invocationsKonstantin Savelev
1086VBSeesionReaderThis Snippet read a field in table from dataset sessionDuong Hong Minh
1085VBSessionWriterThis Snippet use to save a value to specific field in table of sessionDuong Hong Minh
1084VBRead filed from table from dataset SessionDuong Hong Minh
1083VBRound the Corners of a FormRound the corners of a windows form
1082CSharpnUnit TestFixtureCreate an empty nUnit testfixture, namespace plus class including attributed empty methods for startup/teardown and testfixture -startup/-teardown. Finally a first empty test.Magnus Martensson
1081csharpCreate Comparer By a PropertyCreate a class that inherits from IComparer<> and which uses a property to compare the objects.Rick Love
1080csharpImmutable Class or StructCreate a class or struct with private readonly fields and readonly Properties and a constructor to initialize the values.
1079csharpImmutable Class or StructCreate an immutable class or struct with readonly fields, readonly properties, and a constructor to initialize the values.
1078VBCreate Virual Directory ClassCreate IIS Virtual Directory
Usage:
Dim vir As New CreateVirualDirectory
vir.CreateWebFolder(vir.GetCurrentPath() & "\SampleVDir", "SampleVDir", True)
vir.CreateWebFolder("c:\temp\SampleVDirI", "SampleVDirI", False)
vir.CreateWebFolder("c:\temp\SampleVDirII", "SampleVDirII", True)
.net noobie
1077csharp(EntitySpaces) - bind collection to dropdownlistbind an EntitySpaces collection to a dropdownlist. Also uses the [table].Metadata.ColumnNames object to get the column names.Sean Rock
1076csharpGridView Binding with Select (EntitySpaces)a simple binding example using an EntitySpaces collection. esCollection is the type name, e.g. EmployeesCollection, collectionname is your instance name and contol is the control to bind the collection to.
1075CSharpSimple LoadByPrimaryKeydOOdads (www.mygenerationsoftware.com) snippet for simple load by primary key.Mateusz Kierepka
1074CSharpSimple Load (using query)dOOdads (www.mygenerationsoftware.com) snippet for simple query.Mateusz Kierepka
1073CSharpSimple LoaddOOdads (www.mygenerationsoftware.com) snippet for loadAll (using stored procedure).Mateusz Kierepka
1072CSharpMore Complex Load (using query)dOOdads (www.mygenerationsoftware.com) snippet for more Complex Load (using query).Mateusz Kierepka
1071VBNew Custom CollectionCreates a custom Collection Class in Visual Basic .NETJoshua Camara
1070csharpWrite Text to a File (just 3 lines of code)Writes text to a text file. If the file already exists, all of its text will be replaced. Remember, you can use the string "\r\n" to insert newline breaks in the text. This code is adapted from the MSDN article "Writing to a Text File (Visual C#)."Daniel W. Allen
1069csharpASyncComponentPatternThis snippet creates an Async class contruct and includes commented-out code that can be cut-pasted for use in the caller code.Tony Yates
1068csharpTest string for null or emptyInserts a string.IsNullOrEmpty test block, either with Insert Snippet... or Surround With...Andrej Tozon
1067csharptrycfWraps selected code in a try block. Adds catch AND finally blocks as well.Eric Burcham
1066csharpbtrydonutnTry & catch but do nothing. Typically I will initialize a variable to null, attempt to get it in a try/catch and then if it was gotten - and not null - then I do something more. Used in situations where the code is not critical, but we still must catch possible exceptions.Maud Dib
1065csharpaprop boolSnippet for encapsulating a private bool field with a property enforsing PascalStyle for property name and _PascalStyle for field name. The _ allows the name to be grouped in intellisence away from letter a-z.Maud Dib
1064csharpaprop strSnippet for encapsulating a private string field with a property enforsing PascalStyle for property name and _PascalStyle for field name. The _ allows the name to be grouped in intellisence away from letter a-z.Maud Dib
1063csharpaprop intSnippet for encapsulating a private int field with a property enforsing PascalStyle for property name and _PascalStyle for field name. The _ allows the name to be grouped in intellisence away from letter a-z.Maud Dib
1062csharptestunitCreate a unit test method with the test attribute.Mike Weerasinghe
1061csharpwcurSets the current cursor to WaitCursor, creates a try/finally block, and restores the cursor in the "finally" section.Matt Hamilton
1060csharpPublic PropertyAn improved property snippet.
1058VBSingleton Pattern ImplementationSingleton Pattern ImplementationAdrian Godong
1057csharpWCF ServiceThe snippet automates generating a simple WCF (Indigo) contract and the matching implementing service. The service uses the best practices for transaction context, transaction voting, and instance management. Juval Lowy, IDesign Inc.
1056csharpCreate Text File and Write TextThis C# code snippet creates a new text file in the file system and adds text into it. The File Name and two (2) text items can be changed by the user.Manoj Matchado, MVP
1055csharpSingletonwe all aware of Singleton class and very frequently we are using in our projects.This custom snippet helps to define a Singletone class. Anand Kumar
1054csharpOpenFileDialog blockThis snippet inserts a code block for bringing up an OpenFileDialog, allowing you to change the dialog variable name and the filter string, ending up inside the OK (user clicked Open) block.Brian Noyes
1053csharppropmA faster code snippet for property definition complying with the IDesign coding standard - specifically that wrapped member variables have the same name as their corresponding property, prefixed by m_. Also has the get/set blocks expanded for easier code insertion. Based on the built-in prop code snippet.Brian Noyes
1052csharpeventcreates a 2.0 event, including the EventArgs subclass (since usually EventArgs isn't enough, you want to add more information) and declaration of the event using EventHandler<SubclassOfEventArgs> as per the 2.0 design guidelines to use EventHandler<T>Microsoft Corporation
1051csharptwExpand Trace.WriteLine();Axel Rietschin
1050csharpdwExpand Debug.WriteLine();Axel Rietschin
1049csharpdaExpand Debug.Assert();Axel Rietschin
1048csharpaneTest for null parameterAxel Rietschin
1047VBReplace Last Occurence of a StringReplace last string Please see Francesco's article: http://www.devx.com/dotnet/Article/28997Francesco Balena, Michael Sanchez
1046XMLWSDL DefinitionsPlease see Jeffrey's blog for more information: http://pluralsight.com/blogs/jeffsch/archive/2005/06/23/11754.aspxJeffrey Schlimmer
1045csharpEventHandlerList.DataEventEventHandlerList.DataEvent is basically the same as EventHandlerList.Event, the difference is that it allows you to specify an EventsArgs that suits your needs.Pieter Jansen van Vuuren
1044csharpEventHandlerList.EventEventHandlerList.Event uses EventHandlerList to implement events in an object.Pieter Jansen van Vuuren
1043csharpEventHandlerListImplement the EventHandlerList for an object. See the EventHandlerList.Event and EventHandlerList.DataEvent snippets of how to use EventHandlerListPieter Jansen van Vuuren
1042csharpSingletonImplementing the Singleton Pattern in C# - fully lazy instantiation as per http://www.yoda.arachsys.com/csharp/singleton.htmlPieter Jansen van Vuuren
1041csharpIDisposableCode snippet for IDisposable pattern declarationKonstantin Savelev
1040csharpConnection string using DbProviderFactoryCode snippet to take connection string form configuration and create provider factory.Mike Chaliy
1039csharpXPath select first node.Code snippet to select value from the first node returned by specified XPath queryMike Chaliy
1038csharpCaptionHeader comment caption for code blocksMike Chaliy
1037VBAsync Amazon Item Search RequestHow to create and process an async web method call using the 'ItemSearch' method of the Amazon e-commerce serviceLorenzo Minore
1029csharpGroovy Property SnippetCreates a property in C# with wrapping around a private field enforcing the _ prefix. It also provides commenting and encloses the property in a regionJ. Michael Palermo IV
1027csharpProperty with ValueExtension of default prop snippet, but this one allows for a default value. Shortcut name: propv Language: C#Ben Scheirman
1026csharpProperty of Generic ListProperty exposing a list of objects using generics.J. Michael Palermo IV
1025XMLCode Snippet Deployment ManifestThere are options for deploying code snippets, one of which is to use the Visual Studio 2005 VSI model. This code snippet is an XML snippet to help you create the required .vscontent file associated with the VSI file.Tim Heuer
1024CSharpEmail using System.NetA simple snippet to create a mail message and SMTP client using the System.Net.Mail class libraries. This is a simple starter shell to emit the most basic properties.Tim Heuer
1023csharpeventCode snippet for an event and the associated On<EventName> method.Wesley Brown
1022csharpfunThis snippet creates a function in a class.Daniel Skibinski
1021csharpmetThis snippet creates a method in a class.Daniel Skibinski
1020csharpnpropgLate-binding getter only property store. Constructs a type using an empty constructore if the backing property is null.Joe Modjeski
1019csharpcpropComponent property that builds out an On[PropName]Changed event along with the property and backing store.Joe Modjeski
1018csharpConnectionSnippet for database connections.Gaidar Magdanurov
1017CSharpWeb Control PropertyCreates a property (with get and set) which stores a value in viewstate. Useful in custom web controls.Luke Foust