8 public readonly Type type;
9 public readonly
string name;
12 readonly FieldInfo _fieldInfo;
13 readonly PropertyInfo _propertyInfo;
17 type = _fieldInfo.FieldType;
18 name = _fieldInfo.Name;
19 attributes = getAttributes(_fieldInfo.GetCustomAttributes(
false));
24 type = _propertyInfo.PropertyType;
25 name = _propertyInfo.Name;
26 attributes = getAttributes(_propertyInfo.GetCustomAttributes(
false));
32 this.attributes = attributes;
35 public object GetValue(
object obj) {
36 return _fieldInfo != null
37 ? _fieldInfo.GetValue(obj)
38 : _propertyInfo.GetValue(obj, null);
41 public void SetValue(
object obj,
object value) {
42 if(_fieldInfo != null) {
43 _fieldInfo.SetValue(obj, value);
45 _propertyInfo.SetValue(obj, value, null);
51 for(
int i = 0; i < attributes.Length; i++) {
52 var attr = attributes[i];
53 infos[i] =
new AttributeInfo(attr, attr.GetType().GetPublicMemberInfos());