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

◆ TryAdd()

virtual bool System.Xml.XmlBinaryWriterSession.TryAdd ( XmlDictionaryString value,
out int key )
inlinevirtual

Definition at line 176 of file XmlBinaryWriterSession.cs.

177 {
178 if (value == null)
179 {
181 }
182 if (_maps.TryGetValue(value.Dictionary, out var value2))
183 {
184 key = value2[value.Key] - 1;
185 if (key != -1)
186 {
188 }
189 key = Add(value.Value);
190 value2[value.Key] = key + 1;
191 return true;
192 }
193 key = Add(value.Value);
194 value2 = AddKeys(value.Dictionary, value.Key + 1);
195 value2[value.Key] = key + 1;
196 return true;
197 }
bool TryGetValue(TKey key, [MaybeNullWhen(false)] out TValue value)
static string XmlKeyAlreadyExists
Definition SR.cs:412
Definition SR.cs:7
readonly PriorityDictionary< IXmlDictionary, IntArray > _maps
IntArray AddKeys(IXmlDictionary dictionary, int minCount)

References System.Xml.XmlBinaryWriterSession._maps, System.Add, System.Xml.XmlBinaryWriterSession.AddKeys(), System.key, System.Runtime.Serialization.DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull(), System.Runtime.Serialization.DiagnosticUtility.ExceptionUtility.ThrowHelperError(), System.Collections.Generic.Dictionary< TKey, TValue >.TryGetValue(), System.value, and System.SR.XmlKeyAlreadyExists.

Referenced by System.Xml.XmlBinaryNodeWriter.TryGetKey().