private PropertyModel(PropertyInfo prop, TypeModel typeModel) : this(prop.Name) { //TypeModel = typeModel; Getter = prop.GetMethod == null ? null : new MethodModel(prop.GetMethod); Setter = prop.SetMethod == null ? null : new MethodModel(prop.SetMethod); Type = typeModel; Attributes = prop.GetCustomAttributes(false).Select(x => TypeModel.GetType(x.GetType())).ToList(); Access = SetAccessLevel(); }
private TypeModel EmitReturnType(MethodBase method) { MethodInfo methodInfo = method as MethodInfo; if (methodInfo == null) { return(null); } return(TypeModel.GetType(methodInfo.ReturnType)); }
private IEnumerable <TypeModel> EmitAttributes(MethodBase method) { List <TypeModel> attributes = new List <TypeModel>(); foreach (var methodAttribute in method.GetCustomAttributes(false)) { attributes.Add(TypeModel.GetType(methodAttribute.GetType())); } return(attributes); }
public FieldModel(object[] attributes, string name, bool _private, bool _readonly, TypeModel typeModel) { Name = name; TypeModel = typeModel; Attributes = attributes.Select(x => TypeModel.GetType(x.GetType())).ToList(); if (_private) { Access = AccessLevel.Private; } else if (typeModel.Modifiers != null) { Access = typeModel.Modifiers.Item1; } IsReadOnly = _readonly; }
private IEnumerable <FieldModel> EmitParameters(IEnumerable <ParameterInfo> parms) { return(from parm in parms select new FieldModel(parm.GetCustomAttributes(false), parm.Name, false, false, TypeModel.GetType(parm.ParameterType))); }
public static IEnumerable <PropertyModel> EmitProperties(PropertyInfo[] props) { return(from prop in props //where prop.GetGetMethod().GetVisible() || prop.GetSetMethod().GetVisible() select new PropertyModel(prop, TypeModel.GetType(prop.PropertyType))); }