public static void AddPropertyInfos(List <GenericPropertyCodeElement> properties, List <PropertyInfo> propertyInfos) { foreach (PropertyInfo propertyInfo in propertyInfos) { string name = propertyInfo.Name; Type type = propertyInfo.PropertyType; AccessType access = AccessType.Public; GenericPropertyCodeElement p = new GenericPropertyCodeElement(type, name, access); MethodInfo[] accessors = propertyInfo.GetAccessors(true); foreach (MethodInfo m in accessors) { AccessType acc = GetAccessType(m); if (m.Name.StartsWith("get_")) { p.Getter.Access = acc; p.Getter.CodeLines.Add("throw new System.NotImplementedException ();"); } else if (m.Name.StartsWith("set_")) { p.Setter.Access = acc; p.Setter.CodeLines.Add("throw new System.NotImplementedException ();"); } } AddAttributes(p.Attributes, propertyInfo.GetCustomAttributes(false)); // AccessType access = (getterAccess <= setterAccess ? getterAccess : setterAccess); properties.Add(p); } }
public Member(GenericPropertyCodeElement parent, string getOrSet) { this.getOrSet = getOrSet; this.parent = parent; }