Visual Basic 8 (2005)Visual Studio .NET 2003.NET 2.0C# 2.0中级开发Visual StudioWindows.NETVisual BasicC#
页面标题注释的代码片段。






1.80/5 (5投票s)
这只是一个用于页面标题注释的代码片段,
引言
这篇文章/代码片段对于规范你的代码管理很有用。例如,每个类文件都应该包含关于作者、创建日期和其他相关信息的注释。本文包含两个代码片段,一个是 C#,另一个是 Vb.Net。
背景
代码片段只是我们在编码中使用的 XML 文件,用于显示预定义的代码。
使用代码
每个编码文件(.cs 或 .vb)都应该包含关于作者、创建命名空间和其他相关信息。
将附件文件复制到以下位置:
.
Vb 代码片段的位置:
C:\Program Files\Microsoft Visual Studio 8\VB\Snippets\1033\application
C# 代码片段的位置:
C:\Program Files\Microsoft Visual Studio 8\VC#\Snippets\1033\Visual C#
如何使用代码片段:
对于 VB.NET:
转到任意 .vb 页面,并在页面顶部行右键单击。
然后单击“插入代码片段” -> 选择“Application” -> 选择“#PageHeader”。
然后填写代码片段中提到的所有值。
对于 C#
转到任意 .cs 页面,并在页面顶部行右键单击。
然后单击“插入代码片段” -> 选择“Visual C#” -> 选择“#PageHeader”。
然后填写代码片段中提到的所有值。
如果你仍然遇到任何问题,请随时与我联系。
代码片段
如果你发现附件文件有问题,请复制以下代码。
C# 代码片段。
<?xml version="1.0" encoding="utf-8" ?> <CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet"> <CodeSnippet Format="1.0.0"> <Header> <Title>#Pageheader </Title> <Shortcut>#Pageheader</Shortcut> <Description>Code snippet for Page Heading Details</Description> <Author>Rajesh ("mailto:rsoni1980@yahoo.com)</Author">rsoni1980@yahoo.com)</Author> <SnippetTypes> <SnippetType>Expansion</SnippetType> <SnippetType>SurroundsWith</SnippetType> </SnippetTypes> </Header> <Snippet> <Declarations> <Literal> <ID>ClassName</ID> <ToolTip>Class Name</ToolTip> <Default>MyClass</Default> </Literal> <Literal> <ID>CreatedBy</ID> <ToolTip>Name of the Creator</ToolTip> <Default></Default> </Literal> <Literal> <ID>CreatedOn</ID> <ToolTip>Date of Creation</ToolTip> <Default></Default> </Literal> <Literal> <ID>Interfaces</ID> <ToolTip>Interfaces on which it is implemented</ToolTip> <Default>None</Default> </Literal> <Literal> <ID>BaseClass</ID> <ToolTip>Base Class Name</ToolTip> <Default>None</Default> </Literal> <Literal> <ID>Purpose</ID> <ToolTip>Purpose of this Class </ToolTip> <Default></Default> </Literal> </Declarations> <Code Language="csharp"><![CDATA[#region Page Header /********** Class Name : $ClassName$ Created By : $CreatedBy$ Created On : $CreatedOn$ Interfaces : $Interfaces$ BaseClass : $BaseClass$ Purpose : $Purpose$ Version: Version When Who Why 1.0 $CreatedOn$ $CreatedBy$ Initial Draft. ****************/ #endregion Page Header ]]> </Code> </Snippet> </CodeSnippet> </CodeSnippets>
VB.NET 代码片段。
<?xml version="1.0" encoding="utf-8" ?> <CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet"> <CodeSnippet Format="1.0.0"> <Header> <Title>#Pageheader </Title> <Shortcut>#Pageheader</Shortcut> <Description>Code snippet for Page Heading Details</Description> <Author>Rajesh ("mailto:rsoni1980@yahoo.com)</Author">rsoni1980@yahoo.com)</Author> <SnippetTypes> <SnippetType>Expansion</SnippetType> <SnippetType>SurroundsWith</SnippetType> </SnippetTypes> </Header> <Snippet> <Declarations> <Literal> <ID>ClassName</ID> <ToolTip>Class Name</ToolTip> <Default>MyClass</Default> </Literal> <Literal> <ID>CreatedBy</ID> <ToolTip>Name of the Creator</ToolTip> <Default></Default> </Literal> <Literal> <ID>CreatedOn</ID> <ToolTip>Date of Creation</ToolTip> <Default></Default> </Literal> <Literal> <ID>Interfaces</ID> <ToolTip>Interfaces on which it is implemented</ToolTip> <Default>None</Default> </Literal> <Literal> <ID>BaseClass</ID> <ToolTip>Base Class Name</ToolTip> <Default>None</Default> </Literal> <Literal> <ID>Purpose</ID> <ToolTip>Purpose of this Class </ToolTip> <Default></Default> </Literal> </Declarations> <Code Language="VB"><![CDATA[#Region "Page Header" 'Class Name : $ClassName$ 'Created By : $CreatedBy$ 'Created On : $CreatedOn$ 'Interfaces : $Interfaces$ 'BaseClass : $BaseClass$ 'Purpose : $Purpose$ 'Version: Version When Who Why ' 1.0 $CreatedOn$ $CreatedBy$ Initial Draft. ' #end Region ]]> </Code> </Snippet> </CodeSnippet> </CodeSnippets>