System.Runtime.Serialization.XsdDataContractExporter.GetSchemaType C# (CSharp) Метод

GetSchemaType() публичный Метод

public GetSchemaType ( Type type ) : XmlSchemaType
type System.Type
Результат System.Xml.Schema.XmlSchemaType
        public XmlSchemaType GetSchemaType(Type type)
        {
            if (type == null)
                throw System.Runtime.Serialization.DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentNullException(nameof(type)));
            type = GetSurrogatedType(type);
            DataContract dataContract = DataContract.GetDataContract(type);
            DataContractSet.EnsureTypeNotGeneric(dataContract.UnderlyingType);
            XmlDataContract xmlDataContract = dataContract as XmlDataContract;
            if (xmlDataContract != null && xmlDataContract.IsAnonymous)
                return xmlDataContract.XsdType;
            return null;
        }

Same methods

XsdDataContractExporter::GetSchemaType ( System type ) : System.Xml.Schema.XmlSchemaType

Usage Example

Пример #1
0
		public void PrimitiveType ()
		{
			XsdDataContractExporter xdce = new XsdDataContractExporter ();
			Assert.AreEqual (1, xdce.Schemas.Count);

			Assert.IsNull (xdce.GetSchemaType (typeof (int)));
			Assert.AreEqual (new QName ("int", XmlSchema.Namespace), xdce.GetSchemaTypeName (typeof (int)));

			xdce.Export (typeof (int));
			Assert.IsNull (xdce.GetSchemaType (typeof (int)));
			Assert.AreEqual (new QName ("int", XmlSchema.Namespace), xdce.GetSchemaTypeName (typeof (int)));
		}
All Usage Examples Of System.Runtime.Serialization.XsdDataContractExporter::GetSchemaType