Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?xml version="1.0" encoding="utf-8"?>
- <CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
- <CodeSnippet Format="1.0.0">
- <Header>
- <Title>Check if argument is null</Title>
- <Shortcut>can</Shortcut>
- <Description>
- </Description>
- <Author>Michal A. Valasek</Author>
- </Header>
- <Snippet>
- <Declarations>
- <Literal Editable="true">
- <ID>ArgumentName</ID>
- <ToolTip>
- </ToolTip>
- <Default>arg</Default>
- <Function>
- </Function>
- </Literal>
- </Declarations>
- <Code Language="csharp">
- <![CDATA[if($ArgumentName$ == null) throw new ArgumentNullException("$ArgumentName$");
- ]]>
- </Code>
- </Snippet>
- </CodeSnippet>
- <CodeSnippet Format="1.0.0">
- <Header>
- <Title>Check if argument is empty string</Title>
- <Shortcut>cae</Shortcut>
- <Description>
- </Description>
- <Author>Michal A. Valasek</Author>
- </Header>
- <Snippet>
- <Declarations>
- <Literal Editable="true">
- <ID>ArgumentName</ID>
- <ToolTip>
- </ToolTip>
- <Default>arg</Default>
- <Function>
- </Function>
- </Literal>
- </Declarations>
- <Code Language="csharp"><![CDATA[if(string.IsNullOrEmpty($ArgumentName$)) throw new ArgumentException("Value cannot be null or empty string.", "$ArgumentName$");]]></Code>
- </Snippet>
- </CodeSnippet>
- <CodeSnippet Format="1.0.0">
- <Header>
- <Title>Check if argument is null or empty string</Title>
- <Shortcut>cane</Shortcut>
- <Description>
- </Description>
- <Author>Michal A. Valasek</Author>
- </Header>
- <Snippet>
- <Declarations>
- <Literal Editable="true">
- <ID>ArgumentName</ID>
- <ToolTip>
- </ToolTip>
- <Default>arg</Default>
- <Function>
- </Function>
- </Literal>
- </Declarations>
- <Code Language="csharp">
- <![CDATA[if($ArgumentName$ == null) throw new ArgumentNullException("$ArgumentName$");
- if(string.IsNullOrEmpty($ArgumentName$)) throw new ArgumentException("Value cannot be null or empty string.", "$ArgumentName$");
- ]]>
- </Code>
- </Snippet>
- </CodeSnippet>
- <CodeSnippet Format="1.0.0">
- <Header>
- <Title>Check if argument is null, empty or whitespace string</Title>
- <Shortcut>canew</Shortcut>
- <Description>
- </Description>
- <Author>Michal A. Valasek</Author>
- </Header>
- <Snippet>
- <Declarations>
- <Literal Editable="true">
- <ID>ArgumentName</ID>
- <ToolTip>
- </ToolTip>
- <Default>arg</Default>
- <Function>
- </Function>
- </Literal>
- </Declarations>
- <Code Language="csharp">
- <![CDATA[if($ArgumentName$ == null) throw new ArgumentNullException("$ArgumentName$");
- if(string.IsNullOrWhiteSpace($ArgumentName$)) throw new ArgumentException("Value cannot be empty or whitespace only string.", "$ArgumentName$");
- ]]>
- </Code>
- </Snippet>
- </CodeSnippet>
- <CodeSnippet Format="1.0.0">
- <Header>
- <Title>Response redirect</Title>
- <Shortcut>rr</Shortcut>
- <Description>Performs response redirect</Description>
- <Author>Michal A. Valasek</Author>
- </Header>
- <Snippet>
- <Declarations>
- <Literal Editable="true">
- <ID>Url</ID>
- <ToolTip>
- </ToolTip>
- <Default>Default.aspx</Default>
- <Function>
- </Function>
- </Literal>
- </Declarations>
- <Code Language="csharp"><![CDATA[Response.Redirect("$Url$");]]></Code>
- </Snippet>
- </CodeSnippet>
- <CodeSnippet Format="1.0.0">
- <Header>
- <Title>If not is valid, return</Title>
- <Shortcut>invr</Shortcut>
- <Description>Skips processing on validation errors</Description>
- <Author>Michal A. Valasek</Author>
- </Header>
- <Snippet>
- <Code Language="csharp"><![CDATA[if(!this.IsValid) return;$end$]]></Code>
- </Snippet>
- </CodeSnippet>
- <CodeSnippet Format="1.0.0">
- <Header>
- <Title>Create configuration property</Title>
- <Shortcut>cprop</Shortcut>
- <Description>
- </Description>
- <Author>Michal A. Valasek</Author>
- </Header>
- <Snippet>
- <Declarations>
- <Literal Editable="true">
- <ID>Attribute</ID>
- <ToolTip>
- </ToolTip>
- <Default>name</Default>
- <Function>
- </Function>
- </Literal>
- <Literal Editable="true">
- <ID>Property</ID>
- <ToolTip>
- </ToolTip>
- <Default>Name</Default>
- <Function>
- </Function>
- </Literal>
- <Literal Editable="true">
- <ID>Required</ID>
- <ToolTip>
- </ToolTip>
- <Default>false</Default>
- <Function>
- </Function>
- </Literal>
- <Literal Editable="true">
- <ID>Default</ID>
- <ToolTip>
- </ToolTip>
- <Default>""</Default>
- <Function>
- </Function>
- </Literal>
- <Object Editable="true">
- <ID>Type</ID>
- <ToolTip>
- </ToolTip>
- <Default>string</Default>
- <Function>
- </Function>
- </Object>
- </Declarations>
- <Code Language="csharp">
- <![CDATA[[ConfigurationProperty("$Attribute$", IsRequired = $Required$, DefaultValue = $Default$)]
- public $Type$ $Property$ {
- get { return ($Type$)this["$Attribute$"]; }
- set { this["$Attribute$"] = value; }
- }]]>
- </Code>
- </Snippet>
- </CodeSnippet>
- <CodeSnippet Format="1.0.0">
- <Header>
- <Title>Create configuration element</Title>
- <Shortcut>celm</Shortcut>
- <Description>
- </Description>
- <Author>Michal A. Valášek</Author>
- </Header>
- <Snippet>
- <Declarations>
- <Literal Editable="true">
- <ID>ElementName</ID>
- <ToolTip>
- </ToolTip>
- <Default>name</Default>
- <Function>
- </Function>
- </Literal>
- <Literal Editable="true">
- <ID>PropertyName</ID>
- <ToolTip>
- </ToolTip>
- <Default>Name</Default>
- <Function>
- </Function>
- </Literal>
- </Declarations>
- <Code Language="csharp">
- <![CDATA[[ConfigurationProperty("$ElementName$")]
- public $PropertyName$Element $PropertyName$ {
- get { return this["$ElementName$"] as $PropertyName$Element; }
- set { this["$ElementName$"] = value; }
- }]]>
- </Code>
- </Snippet>
- </CodeSnippet>
- <CodeSnippet Format="1.0.0">
- <Header>
- <Title>Create web control property</Title>
- <Shortcut>wprop</Shortcut>
- <Description>
- </Description>
- <Author>Michal A. Valasek</Author>
- </Header>
- <Snippet>
- <Declarations>
- <Literal Editable="true">
- <ID>Property</ID>
- <ToolTip>
- </ToolTip>
- <Default>Name</Default>
- <Function>
- </Function>
- </Literal>
- <Object Editable="true">
- <ID>Type</ID>
- <ToolTip>
- </ToolTip>
- <Default>string</Default>
- <Function>
- </Function>
- </Object>
- </Declarations>
- <Code Language="csharp">
- <![CDATA[public $Type$ $Property$ {
- get { return ($Type$)this.ViewState["$Property$"]; }
- set { this.ViewState["$Property$"] = value; }
- }]]>
- </Code>
- </Snippet>
- </CodeSnippet>
- </CodeSnippets>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement