public static IEnumerable <ITypeMetadata> LoadGenericTypeArguments(bool isGeneric, string typeFullName, CodeDomFileMetadata file) { if (isGeneric == false) { return(new ITypeMetadata[0]); } return(LazyCodeDomTypeMetadata.ExtractGenericTypeNames(typeFullName).Select(fullName => { if (fullName.EndsWith("[]")) { fullName = $"System.Collections.Generic.ICollection<{fullName.TrimEnd('[', ']')}>"; } var isNullable = fullName.EndsWith("?") || fullName.StartsWith("System.Nullable<"); if (isNullable) { fullName = fullName.EndsWith("?") ? fullName.TrimEnd('?') : fullName.Substring(16, fullName.Length - 17); return new LazyCodeDomTypeMetadata(fullName, true, false, file); } var isTask = fullName.StartsWith("System.Threading.Tasks.Task"); if (isTask) { fullName = fullName.Contains("<") ? fullName.Substring(28, fullName.Length - 29) : "System.Void"; isNullable = fullName.EndsWith("?") || fullName.StartsWith("System.Nullable<"); if (isNullable) { fullName = fullName.EndsWith("?") ? fullName.TrimEnd('?') : fullName.Substring(16, fullName.Length - 17); return new LazyCodeDomTypeMetadata(fullName, true, true, file); } return new LazyCodeDomTypeMetadata(fullName, false, true, file); } return new LazyCodeDomTypeMetadata(fullName, false, false, file); })); }
internal static IEnumerable <ITypeParameterMetadata> FromFullName(string fullName) { return(LazyCodeDomTypeMetadata.ExtractGenericTypeNames(fullName).Select(n => new CodeDomTypeParameterMetadata(n.Trim()))); }