public static string ToTSObjects(Type type, string inputName, string outputName) { var typeFullName = TypeFullName.GetTypeFullName(type); var typeFullNameWithDynamic = TypeFullName.GetTypeFullName_WithDynamic(type); if (TypeFullName.IsTeklaType(type)) { if (typeFullNameWithDynamic.EndsWith("[]", StringComparison.InvariantCulture)) { return(outputName + " = " + typeFullNameWithDynamic.Replace("[]", "") + "Array_.GetTSObject(" + inputName + ");"); } else { return(outputName + " = " + typeFullNameWithDynamic + "_.GetTSObject(" + inputName + ");"); } } else if (typeof(ArrayList).IsAssignableFrom(type)) { return(outputName + " = ArrayListConverter.ToTSObjects(" + inputName + ");"); } else if (typeFullName.StartsWith("System.Collections.Generic.List<", StringComparison.InvariantCulture) || typeFullName.StartsWith("System.Collections.Generic.IList<", StringComparison.InvariantCulture) ) { if (typeFullName.StartsWith("System.Collections.Generic.List<System.Collections.Generic.List<", StringComparison.InvariantCulture) || typeFullName.StartsWith("System.Collections.Generic.IList<System.Collections.Generic.IList<", StringComparison.InvariantCulture)) { return(outputName + " = ListOfListConverter.ToTSObjects(" + inputName + ");"); } else { return(outputName + " = ListConverter.ToTSObjects(" + inputName + ");"); } } else if (typeof(System.Type).IsAssignableFrom(type) || typeof(System.Type[]).IsAssignableFrom(type)) { return(outputName + " = TypeConverter.ToTSObjects(" + inputName + ");"); } else if (typeof(IEnumerable).IsAssignableFrom(type)) { //var ienumerableParameters = typeFullName.Substring(typeFullName.IndexOf("<"), typeFullName.Length - typeFullName.IndexOf("<")); return(outputName + " = IEnumerableConverter.ToTSObjects(" + inputName + ");"); } else if (typeFullName.StartsWith("System.Tuple", StringComparison.InvariantCulture)) { var tupleParams = typeFullName.Substring(typeFullName.IndexOf("<"), typeFullName.Length - typeFullName.IndexOf("<")); return(outputName + " = TupleConverter.ToTSObjects" + tupleParams + "(" + inputName + ");"); } else if (typeFullName.StartsWith("System.Nullable", StringComparison.InvariantCulture)) { return(outputName + " = NullableConverter.ToTSObjects(" + inputName + ");"); } else { return(outputName + " = ObjectConverter.ToTSObject(" + inputName + ");"); } }