自定义特性。配合枚举使用棒棒哒

Posted 小小的菜鸟程序员

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了自定义特性。配合枚举使用棒棒哒相关的知识,希望对你有一定的参考价值。

 1 /// <summary>
 2 /// 自定义特性,比系统的display增加了一些参数 Created by ZhangQC 2015.08.19
 3 /// </summary>
 4 [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property,
 5 AllowMultiple = false, Inherited = false)]
 6 public sealed class CustomAttribute:Attribute
 7 {
 8 
 9 public string Name { get; set; }
10 
11 public object Value { get; set; }
12 
13 public object Value1 { get; set; }
14 
15 public object Value2 { get; set; }
16 
17 
18 /// <summary>
19 /// 无参构造函数(Enum写法[Custom(Name="xx",Value=xx1,Value1=xx2,Value2=xx3)]) Created by ZhangQC 2015.08.19
20 /// </summary>
21 public CustomAttribute()
22 {
23 }
24 
25 /// <summary>
26 /// 有参构造函数(Enum写法[Custom("xx",xx1,xx2,xx3)]) Created by ZhangQC 2015.08.19
27 /// </summary>
28 /// <param name="name"></param>
29 /// <param name="value"></param>
30 /// <param name="value1"></param>
31 /// <param name="value2"></param>
32 public CustomAttribute(string name,object value,object value1,object value2)
33 {
34 this.Name = name;
35 this.Value = value;
36 this.Value1 = value1;
37 this.Value2 = value2;
38 }
39 
40 /// <summary>
41 /// 有参构造函数(Enum写法[Custom("xx")]) Created by ZhangQC 2015.08.19
42 /// </summary>
43 /// <param name="name"></param>
44 public CustomAttribute(string name)
45 {
46 this.Name = name;
47 }
48 
49 /// <summary>
50 /// 有参构造函数(Enum写法[Custom("xx",xx1)]) Created by ZhangQC 2015.08.19
51 /// </summary>
52 /// <param name="name"></param>
53 /// <param name="value"></param>
54 public CustomAttribute(string name, object value)
55 {
56 this.Name = name;
57 this.Value = value;
58 }
59 /// <summary>
60 /// 有参构造函数(Enum写法[Custom("xx",xx1,xx2)]) Created by ZhangQC 2015.08.19
61 /// </summary>
62 /// <param name="name"></param>
63 /// <param name="value"></param>
64 /// <param name="value1"></param>
65 public CustomAttribute(string name, object value, object value1)
66 {
67 this.Name = name;
68 this.Value = value;
69 }
70 
71 }

 

以上是关于自定义特性。配合枚举使用棒棒哒的主要内容,如果未能解决你的问题,请参考以下文章

Cognos做大数据分析也可以棒棒哒

[译] AR SDK的种类比你想得要多!这里介绍七个棒棒哒

UWP 滚动条私人定制

UWP 滚动条私人定制

Python使用matplotlib可视化发散棒棒糖图发散棒棒糖图可以同时处理负值和正值并按照大小排序区分数据为发散棒棒糖图的特定数据点添加标签自定义背景填充色自定义数据点颜色

活动/片段转换是不是与棒棒糖之前的设备兼容?