您的位置:首页 > 移动开发 > Unity3D

为Unity项目生成文档(一)

2014-09-03 17:23 148 查看
VS代码中使用Xml注释,并通过Sandcastle生成chm文档的文章,这几篇值得分享:

使用.NET中的XML注释(一) -- XML注释标签讲解

使用.NET中的XML注释(二) -- 创建帮助文档入门篇

VS中的XML注释语法:

建议的文档注释标记(C# 编程指南)





请重点看下面方法的xml注释:

[code]/// <summary>
///     根据用户Id得到用户名.
///     <para>
///         此处添加第二段Summary信息,在MSDN中很少使用.所以不推荐使用.
///     </para>
/// </summary>
/// <remarks>
///     如果没有找到用户则返回null.<br/>
///     <paramref name="userId"/> 参数为正整数.<br/>
///     用户Id模型属性定义参见<see cref="UserInfo.UserId"/><br/>
///     相关方法:<seealso cref="UserBL.GetUserId"/>
/// </remarks>
/// <param name="userId">用户Id</param>
/// <returns>用户真实姓名</returns>
/// <example>
///     返回用户id为100的用户真实姓名:
///     <code>
///         private string userName = string.Empty;
///         userName = UserBL.GetUserName(100);
///     </code>
///     返回的用户名可能为null,使用时要先判断:<br/>
///     <c>if(userName!=null){...}</c>
/// </example>
/// <exception cref="System.ApplicationException">
///     如果用户Id小于0则抛出此异常
/// </exception>
public static string GetUserName(long userId)
{
string result = string.Empty;
if (userId < 0)
    {
throw new System.ApplicationException();
}
else if (userId == 0)
    {
result = null;
}
else
    {
result = "Robert";
}
return result;
}

生成chm文档后的截图





摘要:





展开详细文档信息:



内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: