Add a description for a property

前端 未结 2 2111
长发绾君心
长发绾君心 2021-02-19 18:44

How do I add a text description for my property?

\"alt

My code :

private bool _Space         


        
2条回答
  •  耶瑟儿~
    2021-02-19 19:17

    If you want to see the description in the Visual Studio designer (or any other compatible IDE), you'll need to use design-time attributes for components which are defined in System.ComponentModel namespace.

    [Description("This is the description of Space Key.")]
    public bool SpaceKey { get; set; }
    

    Before doing so, consider learning how to write a good description from descriptions in class library (though they're not always helpful, either). It's good to follow the existing style.

    If you want to see hints in code, like tooltips when selecting a member with IntelliSense, you need to also use XML comments for documentation:

    /// 
    /// Gets or sets space key (that would probably make a bad summary).
    /// 
    public bool SpaceKey { get; set; }
    

    That's it.

提交回复
热议问题