private void buildClass(ClassRepTemplate klass, Type t) { // Grab common fields buildInterface(klass, t); // Grab Constructors foreach (ConstructorInfo c in t.GetConstructors()) { ConstructorRepTemplate consRep = new ConstructorRepTemplate(); buildParameters(consRep.Params, c); consRep.SurroundingType = klass; klass.Constructors.Add(consRep); } // Grab Fields foreach (FieldInfo f in t.GetFields()) { FieldRepTemplate fieldRep = new FieldRepTemplate(); fieldRep.Name = f.Name; fieldRep.Type = new TypeRepRef(TypeHelper.buildTypeName(f.FieldType)); klass.Fields.Add(fieldRep); } // Grab Casts foreach (MethodInfo m in t.GetMethods(BindingFlags.DeclaredOnly | BindingFlags.Public | BindingFlags.Static)) { if (m.IsSpecialName && (m.Name == "op_Explicit" || m.Name == "op_Implicit")) { CastRepTemplate cast = new CastRepTemplate(); cast.To = new TypeRepRef(TypeHelper.buildTypeName(m.ReturnType)); cast.From = new TypeRepRef(TypeHelper.buildTypeName(m.GetParameters()[0].ParameterType)); klass.Casts.Add(cast); } } }