首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在C#中使用C# Vs / Description注释用法

在C#中使用C# Vs / Description注释用法
EN

Stack Overflow用户
提问于 2022-01-05 16:01:14
回答 1查看 76关注 0票数 0

是将 Model_1 描述添加到所有类的编程实践,还是特定于UI元素?

例如,我在Docs女士上找到了这段代码。

Model_1

[Description("Represents a custom button control that responds to a Click event. Displays an image using a custom Source property if the Source property is bound to an Image in the template.")]

public class ImageButton : Button

和?有什么不同?

Model_2

/// <summary>

///Represents a custom button control that responds to a Click event. Displays an image using a custom Source property if the Source property is bound to an Image in the template.

///</summary>

public class ImageButton : Button

在哪里正确地同时使用或 Model_1 描述?

EN

回答 1

Stack Overflow用户

发布于 2022-01-05 20:56:06

首先,您的代码应该足够干净,以避免使用它。为什么?因为你必须支持维护评论,而开发人员通常会忽略这一点。描述应该用于通过nuget交付的接口,以便于使用。第二个描述变体更好,因为您不需要包含任何名称空间。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/70595917

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档