public CollectionMetaToken(Type actualType) { if (!SpeciallySerializedCollections.Any(type => (actualType.IsGenericType && type == actualType.GetGenericTypeDefinition()) || type == actualType)) { IsCollection = false; return; } ActualType = actualType; FormalElementType = typeof(object); FormalKeyType = typeof(object); FormalValueType = typeof(object); var ifaces = actualType.GetInterfaces(); foreach (var prior in CollectionPriorities) { // there is really no access to modified closure as NRefactory suggests var iface = ifaces.FirstOrDefault(x => (x.IsGenericType ? x.GetGenericTypeDefinition() : x) == prior.Item1); if (iface != null) { prior.Item2(iface, this); return; } } }
public static bool IsCollection(Type actualType) { var typeToCheck = actualType.IsGenericType ? actualType.GetGenericTypeDefinition() : actualType; return(SpeciallySerializedCollections.Contains(typeToCheck)); }