c#获取注释文件中的内容

/// <summary>
/// 这是一个测试注释
/// </summary>
/// <param name="args">测试</param>
static void Main(string[] args)
{
    var method = typeof(Program).GetMethod("Main", (System.Reflection.BindingFlags)(-1));

    var comment = CSCommentReader.Create(method);

    Console.WriteLine("summary:" + comment.Summary);
    Console.WriteLine("param:");
    foreach (var param in comment.Param)
    {
        Console.WriteLine($"    {param.Key} , {param.Value}");
    }

    Console.ReadLine();
    Console.WriteLine();
}



 

posted @ 2023-06-21 00:27  ITMrRight  阅读(104)  评论(0编辑  收藏  举报