public static ClassifiedCollection <Type, Pair <Type, Type[]> > GetGenericTypes(this DomainModel model) { var genericTypes = new ClassifiedCollection <Type, Pair <Type, Type[]> >(pair => new[] { pair.First }); foreach (var typeInfo in model.Types.Where(type => type.UnderlyingType.IsGenericType)) { var typeDefinition = typeInfo.UnderlyingType.GetGenericTypeDefinition(); genericTypes.Add(new Pair <Type, Type[]>(typeDefinition, typeInfo.UnderlyingType.GetGenericArguments())); } return(genericTypes); }
public static ClassifiedCollection <string, Pair <string, string[]> > GetGenericTypes(StoredDomainModel model) { var genericTypes = new ClassifiedCollection <string, Pair <string, string[]> >(pair => new[] { pair.First }); foreach (var typeInfo in model.Types.Where(type => type.IsGeneric)) { var typeDefinitionName = typeInfo.GenericTypeDefinition; genericTypes.Add(new Pair <string, string[]>(typeDefinitionName, typeInfo.GenericArguments)); } return(genericTypes); }