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

◆ GetTypeModel() [2/2]

TypeModel System.Xml.Serialization.ModelScope.GetTypeModel ( Type type,
bool directReference )
inlinepackage

Definition at line 28 of file ModelScope.cs.

29 {
31 {
32 return value;
33 }
35 switch (typeDesc.Kind)
36 {
37 case TypeKind.Enum:
38 value = new EnumModel(type, typeDesc, this);
39 break;
40 case TypeKind.Primitive:
41 value = new PrimitiveModel(type, typeDesc, this);
42 break;
43 case TypeKind.Array:
44 case TypeKind.Collection:
45 case TypeKind.Enumerable:
46 value = new ArrayModel(type, typeDesc, this);
47 break;
48 case TypeKind.Root:
49 case TypeKind.Struct:
50 case TypeKind.Class:
51 value = new StructModel(type, typeDesc, this);
52 break;
53 default:
54 if (!typeDesc.IsSpecial)
55 {
56 throw new NotSupportedException(System.SR.Format(System.SR.XmlUnsupportedTypeKind, type.FullName));
57 }
58 value = new SpecialModel(type, typeDesc, this);
59 break;
60 }
62 return value;
63 }
bool TryGetValue(TKey key, [MaybeNullWhen(false)] out TValue value)
void Add(TKey key, TValue value)
static string Format(string resourceFormat, object p1)
Definition SR.cs:118
static string XmlUnsupportedTypeKind
Definition SR.cs:1398
Definition SR.cs:7
readonly Dictionary< Type, TypeModel > _models
Definition ModelScope.cs:10
TypeDesc GetTypeDesc(string name, string ns)
Definition TypeScope.cs:224

References System.Xml.Serialization.ModelScope._models, System.Xml.Serialization.ModelScope._typeScope, System.Collections.Generic.Dictionary< TKey, TValue >.Add(), System.SR.Format(), System.Xml.Serialization.TypeScope.GetTypeDesc(), System.Collections.Generic.Dictionary< TKey, TValue >.TryGetValue(), System.type, System.value, and System.SR.XmlUnsupportedTypeKind.