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>
<#+      }
}
#>
相關文章
相關標籤/搜索