// This is in a switch, checking to see if you want to create a: // 1 - Admin, 2 - Staff, 3 - Student newUsr = AutoPrompt.Create(); // Yeah, dunno... public static datatype Create() where datatype : new() { datatype dt = new datatype(); CreateWorker(ref dt, typeof(datatype)); return dt; } // Bam, wtf does this do? private static void CreateWorker(ref datatype obj, Type t) { if (t == typeof(object)) return; CreateWorker(ref obj, t.BaseType); foreach (MemberInfo mi in t.GetMembers(BindingFlags.NonPublic | BindingFlags.Instance)) { if (mi.MemberType == MemberTypes.Field) { AutoPrompt ap = Attribute.GetCustomAttribute(mi, typeof(AutoPrompt)) as AutoPrompt; if (ap == null) continue; FieldInfo fi = mi as FieldInfo; string fieldPrompt = ap.PromptText;