PropertyDefinition FindProperty(TypeDefinition cls, string name) { foreach (PropertyDefinition propInfo in cls.Properties) { if (propInfo.Name == name) { return(propInfo); } } if (cls.BaseType == null) { return(null); } string baseType = cls.BaseType.FullName; Type t = Registry.GetType(baseType, false); if (t != null) { PropertyInfo prop = t.GetProperty(name); if (prop != null) { TypeReference tref = new TypeReference(prop.PropertyType.Name, prop.PropertyType.Namespace, null, prop.PropertyType.IsValueType); PropertyDefinition pdef = new PropertyDefinition(name, tref, (Mono.Cecil.PropertyAttributes) 0); PropertyDefinition.CreateGetMethod(pdef); PropertyDefinition.CreateSetMethod(pdef); return(pdef); } } TypeDefinition bcls = cecilLib.FindTypeDefinition(baseType); if (bcls != null) { return(FindProperty(bcls, name)); } else { return(null); } }