WebEnh

.net7 mvc jquery bootstrap json 学习中 第一次学PHP,正在研究中。自学进行时... ... 我的博客 https://enhweb.github.io/ 不错的皮肤:darkgreentrip,iMetro_HD
  首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

C# .net dotnet属性定义属性,以提供显示明称,默认值

Posted on 2016-12-06 19:27  WebEnh  阅读(1566)  评论(0编辑  收藏  举报
//使用显示名称初始化 System.ComponentModel.DisplayNameAttribute 类的新实例。 displayName 显示名称
[DisplayName("weight")]
//初始化默认值 System.ComponentModel.DefaultValueAttribute 类的实例。支持所有类型,如字符串string,double,long,int,object,type,等等
[DefaultValue(100)]
public int Weight { get; set; }