public object Clone() { CompactClass compactClass = new CompactClass(); compactClass.Name = Name != null ? (string)Name.Clone() : null; compactClass.ID = ID != null ? (string)ID.Clone() : null; compactClass.Assembly = Assembly != null ? (string)Assembly.Clone() : null; compactClass.Type = Type != null ? (string)Type.Clone() : null; compactClass.IsGeneric = IsGeneric; compactClass.GenericId = GenericId != null ? (string)GenericId.Clone() : null; compactClass.NumberOfArgs = NumberOfArgs != null ? (string)NumberOfArgs.Clone() : null; compactClass.GenericArgumentTypes = GenericArgumentTypes != null ? (GenericArgumentType[])GenericArgumentTypes.Clone() : null; compactClass.NonCompactFields = NonCompactFields != null ? (Attrib[])NonCompactFields.Clone() : null; return(compactClass); }
private static Hashtable GetCompactClass(CompactClass cls) { Hashtable settings = new Hashtable(); settings.Add("id", cls.ID); settings.Add("name", cls.Name); settings.Add("assembly", cls.Assembly); settings.Add("portable", cls.Portable); settings.Add("type", cls.Type); settings.Add("generic-id", cls.GenericId); settings.Add("is-generic", cls.IsGeneric); settings.Add("num-of-args", cls.NumberOfArgs); Hashtable argTypes = null; if (cls.IsGeneric && cls.GenericArgumentTypeList != null) { argTypes = new Hashtable(); foreach (GenericArgumentType gat in cls.GenericArgumentTypeList) { argTypes.Add(gat.ID, GetArgumentType(gat)); } settings.Add("arg-types", argTypes); } Hashtable nonCompactFields = null; if (cls.NonCompactFieldsTable.Count > 0) { nonCompactFields = new System.Collections.Hashtable(); foreach (Attrib attrib in cls.NonCompactFields) { Hashtable nonCompactAttributes = new System.Collections.Hashtable(); nonCompactAttributes.Add("name", attrib.Name); nonCompactAttributes.Add("type", attrib.Type); nonCompactAttributes.Add("id", attrib.ID); nonCompactFields.Add(attrib.ID, nonCompactAttributes); } settings.Add("non-compact-fields", nonCompactFields); } return(settings); }