System.Runtime.Serialization.XsdDataContractExporter.GetSchemaTypeName C# (CSharp) Method

GetSchemaTypeName() public method

public GetSchemaTypeName ( Type type ) : XmlQualifiedName
type System.Type
return System.Xml.XmlQualifiedName
        public XmlQualifiedName GetSchemaTypeName(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 XmlQualifiedName.Empty;
            return dataContract.StableName;
        }

Same methods

XsdDataContractExporter::GetSchemaTypeName ( System type ) : System.Xml.XmlQualifiedName

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::GetSchemaTypeName