Here is a snippet I created that I like to use when defining properties for webparts. Have fun with it...
<?xml version="1.0" encoding="utf-8" ?><CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet"> <CodeSnippet Format="1.0.0"> <Header> <Title>Sharepoint WebPart Property</Title> <Shortcut>wpprop</Shortcut> <Description>Code snippet for Sharepoint Webpart Property.</Description> <Author>Matthew Mcknight</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> <ID>field</ID> <ToolTip>The variable backing this property</ToolTip> <Default>_myProperty</Default> </Literal> <Literal> <ID>personalizable</ID> <Type>System.Web.UI.WebControls.WebParts.PersonalizationScope</Type> <ToolTip>Personalization Level for this webpart?</ToolTip> <Default>PersonalizationScope.Shared</Default> </Literal> <Literal> <ID>browsable</ID> <Type>System.Boolean</Type> <ToolTip>Is this webpart browsable?</ToolTip> <Default>true</Default> </Literal> <Literal> <ID>description</ID> <ToolTip>The description for this webpart.</ToolTip> <Default>My Description</Default> </Literal> <Literal> <ID>defaultValue</ID> <ToolTip>The default value for this property.</ToolTip> <Default></Default> </Literal> <Literal> <ID>category</ID> <ToolTip>The category to display for this webpart in the webpart editor.</ToolTip> <Default>My Category</Default> </Literal> <Literal> <ID>friendlyName</ID> <ToolTip>The friendly name to display for this webpart.</ToolTip> <Default>My Friendly Name</Default> </Literal> </Declarations> <Code Language="csharp"><![CDATA[private $type$ $property$;
[Personalizable($personalizable$)][WebBrowsable($browsable$)][Description("$description$")][DefaultValue("$defaultValue$")][Category("$category$")][FriendlyName("$friendlyName$")]public $type$ $property${ get { return $field$; } set { $field$ = value; }}$end$]]> </Code> </Snippet> </CodeSnippet></CodeSnippets>
dasBlog theme by Mads Kristensen
Disclaimer The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.