public override void PreConvert() { if (GenericTypes.Count() > 0) { if (GenericTypes.All(t => { if (t is GenericType gType) { return(gType.Constraints.Count() > 0);// All(c => c.DefaultValue != null); } return(false); })) { var name = Name.Split(new char[] { '<' })[0]; var newClass = new ConcreteClass(Closure, name, Access, Partial, new Class[] { new GenericClass(null, name, AccessSpecifier.Public) { GenericTypes = GenericTypes.SelectMany(t => (t as GenericType).Constraints).ToList(), } }) { Methods = Methods.Where(m => m.IsConstructor).ToList() }; } } base.PreConvert(); }
public override void Write(ICSharpFormatter formatter, bool comment = true) { if (_internalType) { return; } //for classes with constraint that says any, create a class to inherit from this with all the parameters replaced as object if (GenericTypes.All(t => { if (t is GenericType gType) { return(gType.Constraints.Any(c => c.Name == "object")); } return(false); })) { var newClass = new ConcreteClass(Closure, base.Name, Access, Partial, new Class[] { this }); } base.Write(formatter, comment); }