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

◆ CheckAndAdd()

static void System.Runtime.Serialization.DataContract.CheckAndAdd ( Type type,
Dictionary< Type, Type > typesChecked,
[NotNullIfNotNull("nameToDataContractTable")] ref Dictionary< XmlQualifiedName, DataContract > nameToDataContractTable )
inlinestaticpackageinherited

Definition at line 2359 of file DataContract.cs.

2360 {
2364 if (nameToDataContractTable == null)
2365 {
2367 }
2369 {
2370 if (DataContractCriticalHelper.GetDataContractAdapterType(value.UnderlyingType) != DataContractCriticalHelper.GetDataContractAdapterType(type) && (!(value is ClassDataContract) || !((ClassDataContract)value).IsKeyValuePairAdapter))
2371 {
2372 throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(System.SR.Format(System.SR.DupContractInKnownTypes, type, value.UnderlyingType, dataContract.StableName.Namespace, dataContract.StableName.Name)));
2373 }
2374 return;
2375 }
2378 }
bool TryGetValue(TKey key, [MaybeNullWhen(false)] out TValue value)
void Add(TKey key, TValue value)
static Dictionary< XmlQualifiedName, DataContract > ImportKnownTypeAttributes(Type type)
DataContract(DataContractCriticalHelper helper)
static DataContract GetDataContract(Type type)
static string Format(string resourceFormat, object p1)
Definition SR.cs:118
static string DupContractInKnownTypes
Definition SR.cs:72
Definition SR.cs:7

References System.Collections.Generic.Dictionary< TKey, TValue >.Add(), System.Runtime.Serialization.Dictionary, System.SR.DupContractInKnownTypes, System.SR.Format(), System.Runtime.Serialization.DataContract.GetDataContract(), System.Runtime.Serialization.DataContract.DataContractCriticalHelper.GetDataContractAdapterType(), System.Runtime.Serialization.DataContract.ImportKnownTypeAttributes(), System.Runtime.Serialization.DiagnosticUtility.ExceptionUtility.ThrowHelperError(), System.Collections.Generic.Dictionary< TKey, TValue >.TryGetValue(), System.type, System.Runtime.Serialization.DataContract.UnwrapNullableType(), and System.value.

Referenced by System.Runtime.Serialization.XmlObjectSerializerContext.GetDataContractsForKnownTypes(), and System.Runtime.Serialization.DataContract.ImportKnownTypeAttributes().