private List<Type> GetKnownTypesFromContext(XmlObjectSerializerContext context, IList<Type> serializerKnownTypeList)
 {
     List<Type> list = new List<Type>();
     if (context != null)
     {
         List<XmlQualifiedName> list2 = new List<XmlQualifiedName>();
         Dictionary<XmlQualifiedName, DataContract>[] dataContractDictionaries = context.scopedKnownTypes.dataContractDictionaries;
         if (dataContractDictionaries != null)
         {
             for (int i = 0; i < dataContractDictionaries.Length; i++)
             {
                 Dictionary<XmlQualifiedName, DataContract> dictionary = dataContractDictionaries[i];
                 if (dictionary != null)
                 {
                     foreach (KeyValuePair<XmlQualifiedName, DataContract> pair in dictionary)
                     {
                         if (!list2.Contains(pair.Key))
                         {
                             list2.Add(pair.Key);
                             list.Add(pair.Value.UnderlyingType);
                         }
                     }
                 }
             }
         }
         if (serializerKnownTypeList != null)
         {
             list.AddRange(serializerKnownTypeList);
         }
     }
     return list;
 }
 protected void PushKnownDataContracts(XmlObjectSerializerContext context)
 {
     if (this.KnownDataContracts != null)
     {
         context.scopedKnownTypes.Push(this.KnownDataContracts);
     }
 }
示例#3
0
 protected void PopKnownDataContracts(XmlObjectSerializerContext context)
 {
     if (KnownDataContracts != null)
     {
         context.scopedKnownTypes.Pop();
     }
 }
示例#4
0
 internal KnownTypeDataContractResolver(XmlObjectSerializerContext context)
 {
     this.context = context;
 }
示例#5
0
 internal KnownTypeDataContractResolver(XmlObjectSerializerContext context)
 {
     Fx.Assert(context != null, "KnownTypeDataContractResolver should not be instantiated with a null context");
     _context = context;
 }
 internal KnownTypeDataContractResolver(XmlObjectSerializerContext context)
 {
     Fx.Assert(context != null, "KnownTypeDataContractResolver should not be instantiated with a null context");
     _context = context;
 }
 internal KnownTypeDataContractResolver(XmlObjectSerializerContext context)
 {
     this.context = context;
 }