Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
XmlDictionary.cs
Go to the documentation of this file.
4
5namespace System.Xml;
6
8{
9 private sealed class EmptyDictionary : IXmlDictionary
10 {
11 public bool TryLookup(string value, [NotNullWhen(true)] out XmlDictionaryString result)
12 {
13 result = null;
14 return false;
15 }
16
17 public bool TryLookup(int key, [NotNullWhen(true)] out XmlDictionaryString result)
18 {
19 result = null;
20 return false;
21 }
22
24 {
25 result = null;
26 return false;
27 }
28 }
29
30 private static IXmlDictionary s_empty;
31
33
35
36 private int _nextId;
37
38 public static IXmlDictionary Empty
39 {
40 get
41 {
42 if (s_empty == null)
43 {
45 }
46 return s_empty;
47 }
48 }
49
51 {
53 _strings = null;
54 _nextId = 0;
55 }
56
63
64 public virtual XmlDictionaryString Add(string value)
65 {
67 {
68 if (_strings == null)
69 {
71 }
72 else if (_nextId == _strings.Length)
73 {
74 int num = _nextId * 2;
75 if (num == 0)
76 {
77 num = 4;
78 }
79 Array.Resize(ref _strings, num);
80 }
84 _nextId++;
85 }
86 return value2;
87 }
88
89 public virtual bool TryLookup(string value, [NotNullWhen(true)] out XmlDictionaryString? result)
90 {
91 return _lookup.TryGetValue(value, out result);
92 }
93
94 public virtual bool TryLookup(int key, [NotNullWhen(true)] out XmlDictionaryString? result)
95 {
97 {
98 result = null;
99 return false;
100 }
101 result = _strings[key];
102 return true;
103 }
104
106 {
107 if (value == null)
108 {
110 }
111 if (value.Dictionary != this)
112 {
113 result = null;
114 return false;
115 }
116 result = value;
117 return true;
118 }
119}
bool TryGetValue(TKey key, [MaybeNullWhen(false)] out TValue value)
void Add(TKey key, TValue value)
bool TryLookup(int key, [NotNullWhen(true)] out XmlDictionaryString result)
bool TryLookup(XmlDictionaryString value, [NotNullWhen(true)] out XmlDictionaryString result)
bool TryLookup(string value, [NotNullWhen(true)] out XmlDictionaryString result)
virtual bool TryLookup(XmlDictionaryString value, [NotNullWhen(true)] out XmlDictionaryString? result)
XmlDictionary(int capacity)
readonly Dictionary< string, XmlDictionaryString > _lookup
virtual XmlDictionaryString Add(string value)
XmlDictionaryString[] _strings
virtual bool TryLookup(int key, [NotNullWhen(true)] out XmlDictionaryString? result)
static IXmlDictionary s_empty
virtual bool TryLookup(string value, [NotNullWhen(true)] out XmlDictionaryString? result)