为Unity项目生成文档(一)
VS生成chm帮助文档
VS代码中使用Xml注释,并通过Sandcastle生成chm文档的文章,这几篇值得分享:
VS的XML注释语法:
微软的建议
标记
注释示例
请重点看下面方法的xml注释:
/// <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文档后的截图





浙公网安备 33010602011771号