Terraria
v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
EnumModel.cs
Go to the documentation of this file.
1
using
System.Collections.Generic
;
2
using
System.Diagnostics.CodeAnalysis
;
3
using
System.Reflection
;
4
5
namespace
System.Xml.Serialization
;
6
7
internal
sealed
class
EnumModel
:
TypeModel
8
{
9
private
ConstantModel
[]
_constants
;
10
11
internal
ConstantModel
[]
Constants
12
{
13
get
14
{
15
if
(
_constants
==
null
)
16
{
17
List<ConstantModel>
list
=
new
List<ConstantModel>
();
18
FieldInfo
[] fields =
base
.Type.GetFields();
19
foreach
(
FieldInfo
fieldInfo
in
fields)
20
{
21
ConstantModel
constantModel
=
GetConstantModel
(
fieldInfo
);
22
if
(
constantModel
!=
null
)
23
{
24
list
.Add(
constantModel
);
25
}
26
}
27
_constants
=
list
.ToArray();
28
}
29
return
_constants
;
30
}
31
}
32
33
internal
EnumModel
([
DynamicallyAccessedMembers
(
DynamicallyAccessedMemberTypes
.All)]
Type
type
,
TypeDesc
typeDesc
,
ModelScope
scope)
34
:
base
(
type
,
typeDesc
, scope)
35
{
36
}
37
38
private
ConstantModel
GetConstantModel
(
FieldInfo
fieldInfo
)
39
{
40
if
(
fieldInfo
.IsSpecialName)
41
{
42
return
null
;
43
}
44
return
new
ConstantModel
(
fieldInfo
, ((
IConvertible
)
fieldInfo
.GetValue(
null
)).ToInt64(
null
));
45
}
46
}
System.Collections.Generic.Dictionary
Definition
Dictionary.cs:14
System.Reflection.FieldInfo
Definition
FieldInfo.cs:8
System.Type
Definition
Type.cs:14
System.Xml.Serialization.ConstantModel
Definition
ConstantModel.cs:6
System.Xml.Serialization.EnumModel._constants
ConstantModel[] _constants
Definition
EnumModel.cs:9
System.Xml.Serialization.EnumModel.EnumModel
EnumModel([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type type, TypeDesc typeDesc, ModelScope scope)
Definition
EnumModel.cs:33
System.Xml.Serialization.EnumModel.GetConstantModel
ConstantModel GetConstantModel(FieldInfo fieldInfo)
Definition
EnumModel.cs:38
System.Xml.Serialization.EnumModel.Constants
ConstantModel[] Constants
Definition
EnumModel.cs:12
System.Xml.Serialization.EnumModel
Definition
EnumModel.cs:8
System.Xml.Serialization.ModelScope
Definition
ModelScope.cs:7
System.Xml.Serialization.TypeDesc
Definition
TypeDesc.cs:7
System.Xml.Serialization.TypeModel
Definition
TypeModel.cs:6
System.IConvertible
Definition
IConvertible.cs:5
System.Collections.Generic
Definition
IHashKeyCollection.cs:1
System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes
DynamicallyAccessedMemberTypes
Definition
DynamicallyAccessedMemberTypes.cs:5
System.Diagnostics.CodeAnalysis
Definition
AllowNullAttribute.cs:1
System.Reflection
Definition
ICustomTypeProvider.cs:1
System.Xml.Serialization
Definition
DateTimeSerializationSection.cs:1
System.Xml.ValueHandleType.Dictionary
@ Dictionary
System.ExceptionArgument.list
@ list
System.ExceptionArgument.type
@ type
source
System.Private.Xml
System.Xml.Serialization
EnumModel.cs
Generated by
1.10.0