GhostDoc使用与原始注释

1、简介c#

  GhostDoc是Visual Studio的一个免费插件,能够为开发人员自动生成XML格式的注释文档。ide

2、下载工具

  须要的朋友能够去这里下载,填个Email地址就能够下了:GhostDoc下载地址ui

3、安装this

  下载安装完成后,能够在Visual Studio的工具菜单下找到GhostDoc的身影。spa

4、使用插件

  在使用的时候,主要是进行设置,设置好了调用快捷键就能够了。code

     

    

    

下面附上,注释的原始文件。blog

文件注释:接口

<#@ template language="C#" #>
// ***********************************************************************
// Assembly         : <#= Context.AssemblyName #>
// Author           : <#= Context.GetGlobalProperty("UserName") #>
// Created          : <#= Context.DestinationFileCreationDateTime.ToString("MM-dd-yyyy") #>
//
// Last Modified By : <#= Context.GetGlobalProperty("UserName") #>
// Last Modified On : <#= Context.DestinationFileModificationDateTime.ToString("MM-dd-yyyy") #>
// ***********************************************************************
// <copyright file="<#= System.IO.Path.GetFileName(Context.DestinationFile) #>" company="<#= Context.GetGlobalProperty("CompanyName") #>">
//     Copyright (c) <#= Context.GetGlobalProperty("CompanyName") #>. All rights reserved.
// </copyright>
// <summary></summary>
// ***********************************************************************
类注释:

 

<#@ template language="C#" #>
<#  CodeElement codeElement = Context.CurrentCodeElement; #>
/// <summary>
///<# GenerateSummaryText(); #>
/// </summary>
<#  if(codeElement.HasTypeParameters)
{
for(int i = 0; i < codeElement.TypeParameters.Length; i++)
{
TypeParameter typeParameter = codeElement.TypeParameters[i];
#>
/// <typeparam name="<#= typeParameter.Name #>"><# GenerateTypeParamText(typeParameter, i); #></typeparam>
<#       }
}
#>
<#= Context.GetNonGeneratedTags() #>
<# GenerateRemarksText(); #>
<#+
private void GenerateSummaryText()
{
if(Context.HasExistingTagText("summary"))
{
this.WriteLine(Context.GetExistingTagText("summary"));
}
else
{
this.WriteLine("Class " + Context.CurrentCodeElement.Name + Context.ExecMacro("$(End)"));
}
}
private void GenerateTypeParamText(TypeParameter typeParameter, int index)
{
if(Context.HasExistingTagText("typeparam", index))
{
this.Write(Context.GetExistingTagText("typeparam", index));
}
else
{
string typeParameterName = typeParameter.Name;
if(typeParameterName != null)
{
if(typeParameterName.Length == 1)
{
this.Write("");
}
else
{
this.Write("The type of " + Context.ExecMacro(typeParameterName, "$(TheAndAll)") + ".");
}
}
}
}
private void GenerateRemarksText()
{
if(Context.HasExistingTagText("remarks"))
{ #>
/// <remarks><#= Context.GetExistingTagText("remarks") #></remarks>
<#+      }
else if (!string.IsNullOrEmpty(Context.GetGlobalProperty("DefaultBlankRemarksText")))
{
// Should you require a default comment, set it in
// Options -> Global Properties -> DefaultBlankRemarksText
#>
/// <remarks><#= Context.GetGlobalProperty("DefaultBlankRemarksText") #></remarks>
<#+      }
}
#>

接口注释:

   

<#@ template language="C#" #>
<#  CodeElement codeElement = Context.CurrentCodeElement; #>
/// <summary>
///<# GenerateSummaryText(); #>
/// </summary>
<#   if(codeElement.HasTypeParameters)
{
for(int i = 0; i < codeElement.TypeParameters.Length; i++)
{
TypeParameter typeParameter = codeElement.TypeParameters[i];
#>
/// <typeparam name="<#= typeParameter.Name #>"><# GenerateTypeParamText(typeParameter, i); #></typeparam>
<#       }
}
#>
<#= Context.GetNonGeneratedTags() #>
<# GenerateRemarksText(); #>
<#+
private void GenerateSummaryText()
{
if(Context.HasExistingTagText("summary"))
{
this.WriteLine(Context.GetExistingTagText("summary"));
}
else
{
this.WriteLine("Interface " + Context.CurrentCodeElement.Name + Context.ExecMacro("$(End)"));
}
}
private void GenerateTypeParamText(TypeParameter typeParameter, int index)
{
if(Context.HasExistingTagText("typeparam", index))
{
this.Write(Context.GetExistingTagText("typeparam", index));
}
else
{
string typeParameterName = typeParameter.Name;
if(typeParameterName != null)
{
if(typeParameterName.Length == 1)
{
this.Write("");
}
else
{
this.Write("The type of " + Context.ExecMacro(typeParameterName, "$(TheAndAll)") + ".");
}
}
}
}
private void GenerateRemarksText()
{
if(Context.HasExistingTagText("remarks"))
{ #>
/// <remarks><#= Context.GetExistingTagText("remarks") #></remarks>
<#+      }
else if (!string.IsNullOrEmpty(Context.GetGlobalProperty("DefaultBlankRemarksText")))
{
// Should you require a default comment, set it in
// Options -> Global Properties -> DefaultBlankRemarksText
#>
/// <remarks><#= Context.GetGlobalProperty("DefaultBlankRemarksText") #></remarks>
<#+      }
}
#>
相关文章
相关标签/搜索