IsContractDeclared() static private method

static private IsContractDeclared ( System.Runtime.Serialization.DataContract contract, System.Runtime.Serialization.DataContract declaredContract ) : bool
contract System.Runtime.Serialization.DataContract
declaredContract System.Runtime.Serialization.DataContract
return bool
 protected virtual bool WriteTypeInfo(XmlWriterDelegator writer, DataContract contract, DataContract declaredContract)
 {
     if (!XmlObjectSerializer.IsContractDeclared(contract, declaredContract))
     {
         if (base.DataContractResolver == null)
         {
             this.WriteTypeInfo(writer, contract.Name, contract.Namespace);
             return(true);
         }
         this.WriteResolvedTypeInfo(writer, contract.OriginalUnderlyingType, declaredContract.OriginalUnderlyingType);
     }
     return(false);
 }
コード例 #2
0
        protected virtual bool WriteTypeInfo(XmlWriterDelegator writer, DataContract contract, DataContract declaredContract)
        {
            if (XmlObjectSerializer.IsContractDeclared(contract, declaredContract))
            {
                return(false);
            }
            bool hasResolver = DataContractResolver != null;

            if (hasResolver)
            {
                WriteResolvedTypeInfo(writer, contract.UnderlyingType, declaredContract.UnderlyingType);
            }
            else
            {
                WriteTypeInfo(writer, contract.Name, contract.Namespace);
            }
            return(hasResolver);
        }