/// <summary> /// Gets the first type of a embedded derived class of a specified basetype that is serialized under the given name. /// </summary> /// <param name="parentType">Parent type.</param> /// <param name="baseType">Base type.</param> /// <param name="name">Serialization name.</param> /// <returns>First embedded derived type if found. Guid.Empty otherwise.</returns> public static Guid TryGetFirstEmbeddedDerivedNameType(Guid parentType, Guid baseType, string name) { Dictionary <String, System.Collections.Generic.List <Guid> > dict; TypeEmbeddedDerivedNameTypes.TryGetValue(parentType, out dict); Dictionary <string, Guid> dictDerived; TypeDerivedNameTypes.TryGetValue(baseType, out dictDerived); if (dict != null && dictDerived != null) { if (dict.ContainsKey(name) && dictDerived.ContainsKey(name)) { List <Guid> val1 = dict[name]; Guid val2 = dictDerived[name]; if (val1.Contains(val2)) { return(val2); } } } return(System.Guid.Empty); }
/// <summary> /// Gets the type of a embedded derived class of a specified basetype that is serialized under the given name. /// </summary> /// <param name="parentType">Base type.</param> /// <param name="name">Serialization name.</param> /// <returns>Embedded derived type if found. Guid.Empty otherwise.</returns> public static System.Collections.Generic.List <Guid> TryGetEmbeddedNameTypes(Guid parentType, string name) { Dictionary <String, System.Collections.Generic.List <Guid> > dict; TypeEmbeddedDerivedNameTypes.TryGetValue(parentType, out dict); if (dict != null) { System.Collections.Generic.List <Guid> val; dict.TryGetValue(name, out val); return(val); } return(null); }