public ListDocumentInfo(Type implementingType) { if (implementingType.IsGenericType) { _listValueType = implementingType.GetGenericArguments()[0]; _documentFieldInfo = new DocumentFieldInfo(_listValueType); _listAdapterFactoryType = ListAdapterFactoryType.Generic; _creatorType = _type.IsInterface || _type.IsArray ? CreatorType.SpecifiedTypeList : CreatorType.SpecifiedType; } else { _listValueType = typeof(object); _documentFieldInfo = new DocumentFieldInfo(_listValueType); _listAdapterFactoryType = ListAdapterFactoryType.NonGeneric; _creatorType = _type.IsInterface || _type.IsArray ? CreatorType.ObjectList : CreatorType.SpecifiedType; } }
public ListDocumentInfo() { if (_type.TryGetImplementingGenericType(out var listType, typeof(IList <>)) || _type.TryGetImplementingGenericType(out listType, typeof(IReadOnlyList <>))) { _listValueType = listType.GetGenericArguments()[0]; _documentFieldInfo = new DocumentFieldInfo(_listValueType); if (_type == listType) { _creatorType = CreatorType.SpecifiedTypeList; _listAdapterFactoryType = ListAdapterFactoryType.NonGeneric; } else if (_type.IsArray) { _creatorType = CreatorType.SpecifiedTypeList; _listAdapterFactoryType = ListAdapterFactoryType.Generic; } else { _creatorType = CreatorType.SpecifiedType; _listAdapterFactoryType = ListAdapterFactoryType.Generic; } }