Skip to content

A collection of snippets for Visual Studio which I find help me staying productive.

Notifications You must be signed in to change notification settings

allansson/vs-snippets

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Description

This repository contains a collection of some of my most frequently used Visual Studio-snippets.

Installation

Download (or clone) the snippets into %USERPROFILE%\Visual Studio 2013\Code Snippets\Visual C#\My Code Snippets. For older versions of Visual Studio, just change the version number in the path to the version desired.

Snippets

confp

Quickly sets up a configuration property, which comes in handy when writing your own configuration section code.

Properties

  • type - The type of the configuration property. Will be used for casting to and from the base-class.
  • name - Name of the C#-property.
  • xmlname - Name of the XML-element in the applications configuration file.

Example Output

private const string MaxRequestsXmlElementName = "maxRequests";

[ConfigurationProperty(MaxRequestsXmlElementName)]
public int MaxRequests
{
	get 
	{
		return (int)base[MaxRequestsXmlElementName];
	}
	set
	{
		base[MaxRequestsXmlElementName] = value;
	}
}

datac

Creates a DataContract-class. Usable when fiddling about alot with WCF-services and the DataContractSerializer.

Properties

  • name - Name of the DataContract-class.

Example Output

[DataContract]
public class MyDataContract
{

}

datam

Creates a DataMember-property. Usable when fiddling about alot with WCF-services and the DataContractSerializer.

Properties

  • type - The type of the DataMember-property
  • name - The name of the DataMember-property

Example Output

[DataMember]
public string CustomerName { get; set; }

License

Seriously? Do I need one? Just do whatever you like with it. :)

About

A collection of snippets for Visual Studio which I find help me staying productive.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published