当前位置:  开发笔记 > 编程语言 > 正文

如何在XML文档中引用C#关键字?

如何解决《如何在XML文档中引用C#关键字?》经验,为你挑选了1个好方法。

,例如,不起作用 - 我收到编译警告: XML comment on ... has syntactically incorrect cref attribute 'switch'


感兴趣的人的背景......

/// Provides base functionality for hand-coded abstractions of API method wrappers, mostly those that abstract over
/// parameters that are required to be JSON-encoded.
public class FacebookArgs : Dictionary
{
    /// Initializes an instance of .
    public FacebookArgs() { }

    /// Intializes an instance of , that contains elements copied from .
    /// 
    public FacebookArgs(IDictionary dictionary)
        : base(dictionary) { }

    /// Gets or sets the value associated with the specified key.
    /// The key of the value to get or set.
    /// The value associated with the specified key.
    /// This implementation hides the base indexer implementation such that specifying a key that does not exist returns null rather than throwing a .
    public new Object this[String key]
    {
        get
        {
            Object value;
            if (this.TryGetValue(key, out value)) return value;
            else return null;
        }
        set { base[key] = value; }
    }

    /// In derived classes, provides specialized serialization logic for specific properties contained in this object.
    /// The key of the property to serialize.
    /// A reference to a dictionary of arguments that will be passed directly to a  object.
    /// 
    /// This method allows specialized serialization logic, such as JSON encoding, to be applied to specific properties.
    /// To implement, use a switch (Select in VB.NET) statement to filter based on  and provide the property-specific logic.
    /// The resulting value should then be added to  using the same .
    /// 
    /// Properties that do not require additional processing (strings, integral values, etc) should be ignored.
    /// 
    protected virtual void SerializeProperty(String key, ref IDictionary args) { }

    /// Returns a dictionary of key/value pairs suitable to be passed a  object.
    /// A dictionary of key/value pairs suitable to be passed a  object.
    /// This method calls the  for each key in the object, which allows property-specific processing
    /// to be done on any property.
    /// 
    public IDictionary GetArgs()
    {
        IDictionary args = new Dictionary();

        foreach (String key in this.Keys)
        {
            this.SerializeProperty(key, ref args);

            if (!args.ContainsKey(key) && this[key] != null)
            {
                args.Add(key, this[key]);
            }
        }

        return args;
    }
}

有问题的标签可以在被发现的标签SerializeProperty.我在冗长的文档方面犯了错误.我还打算提供一些s,我还没有完成它.



1> Jon Skeet..:

cref是指另一个成员 - 一个类,一个方法等.

在这种情况下,您希望它链接到什么?一般来说,你想要的整体效果是什么?

根据这篇优秀的XML文档指南,该标记具有未记录的属性langword:


这对你有帮助吗?可能值得尝试它只是为了看它做什么.

如果您只想使用普通超链接,请使用href而不是cref:

switch


链接的XML文档指南目前正在返回404.这是返回机器上同一篇文章的链接:http://web.archive.org/web/20080623060531/http://thoughtpad.net/alan-dean/cs -xml-documentation.html上
我想` ... `是一个错字.两者,` `和` `适用于普通超链接(使用Sandcastle测试:[SHFB](https:// shfb. codeplex.com/)).
推荐阅读
TXCWB_523
这个屌丝很懒,什么也没留下!
DevBox开发工具箱 | 专业的在线开发工具网站    京公网安备 11010802040832号  |  京ICP备19059560号-6
Copyright © 1998 - 2020 DevBox.CN. All Rights Reserved devBox.cn 开发工具箱 版权所有