小编Nee*_*n K的帖子

如何在XML注释中添加List类型代码示例?

我使用了以下XML评论,

    /// <example> 
    /// This example shows how to use <see cref="SampleCollection"/> property.
    /// <code>
    /// class TestClass 
    /// {
    ///      List<string> collection = new List<string>();
    ///      collection.Add("Column1");
    ///      collection.Add("Column2");
    ///      this.SampleCollection = collection;
    /// }
    /// </code>
    /// </example>        
    public List<string> SampleCollection
    {
        get;
        set;
    }
Run Code Online (Sandbox Code Playgroud)

但它有以下警告错误,

关于'SampleCollection'的XML注释格式错误 - '结束标记'代码'与开始标记'字符串'不匹配.

因为List定义有<string>.所以它认为是XML标签.

有什么方法可以解决这个问题吗?

c# xml-documentation

4
推荐指数
1
解决办法
277
查看次数

标签 统计

c# ×1

xml-documentation ×1