Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ ReflectionCreateCollection()

object System.Runtime.Serialization.ReflectionReader.ReflectionCreateCollection ( CollectionDataContract collectionContract)
inlineprivateinherited

Definition at line 399 of file ReflectionReader.cs.

400 {
402 {
403 Type type = collectionContract.ItemType.MakeArrayType();
406 }
407 if (collectionContract.Kind == CollectionKind.GenericDictionary && collectionContract.UnderlyingType.IsInterface)
408 {
409 Type type2 = Globals.TypeOfDictionaryGeneric.MakeGenericType(collectionContract.ItemType.GetGenericArguments());
410 ConstructorInfo constructor2 = type2.GetConstructor(BindingFlags.Instance | BindingFlags.Public, Type.EmptyTypes);
411 return constructor2.Invoke(Array.Empty<object>());
412 }
413 if (collectionContract.UnderlyingType.IsValueType)
414 {
415 return Activator.CreateInstance(collectionContract.UnderlyingType);
416 }
417 if (collectionContract.UnderlyingType == Globals.TypeOfIDictionary)
418 {
419 return new Dictionary<object, object>();
420 }
422 return constructor3.Invoke(Array.Empty<object>());
423 }
bool IsArrayLikeCollection(CollectionDataContract collectionContract)

References System.Activator.CreateInstance(), System.Type.EmptyTypes, System.type, System.Runtime.Serialization.Globals.TypeOfDictionaryGeneric, and System.Runtime.Serialization.Globals.TypeOfIDictionary.

Referenced by System.Runtime.Serialization.ReflectionReader.ReflectionReadCollectionCore().