[Serializable] DB.NET

.NET development and more (or less)

/// <summary>
/// Daniel Balla's Weblog - Various posts 
/// on .NET Development, ASP.NET, Agile, 
/// TDD, Architecture, SQL and others.
/// </summary>
[Serializable]
class Blog<T> where T : ASP.NET, Ajax, WCF, WF, new()
{
}

Tuesday, September 05, 2006

Dependency property code snippet

As I came across the dependency property (which hit me right when I started developing WinFX) I've created this code snippet to spare me of writting the code every time (the dependency property and the backing property).
You can download it here and then copy it to your Program Files\Microsoft Visual Studio 8\VC#\Snippets\1033\Visual C#\ directory
or you can copy/paste the snippet:




<?xml version="1.0" encoding="utf-8" ?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
<CodeSnippet Format="1.0.0">
<Header>
<Title>dprop</Title>
<Shortcut>dprop</Shortcut>
<Description>Code snippet for dependancy property and backing property</Description>
<Author>Daniel Balla</Author>
<SnippetTypes>
<SnippetType>Expansion</SnippetType>
</SnippetTypes>
</Header>
<Snippet>
<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 Editable="false">
<ID>classname</ID>
<ToolTip>Class name</ToolTip>
<Function>ClassName()</Function>
<Default>ClassNamePlaceholder</Default>
</Literal>
</Declarations>
<Code Language="csharp"><![CDATA[public static DependencyProperty $property$Property =
DependencyProperty.Register("$property$",
typeof($type$), typeof($classname$));

public $type$ $property$
{
get { return (($type$)base.GetValue($property$Property)); }
set { base.SetValue($property$Property, value); }
}$end$]]>
</Code>
</Snippet>
</CodeSnippet>
</CodeSnippets>

Labels:


Gixen - Free Auction Sniper