当前位置: 首页>>代码示例>>C#>>正文


C# SoapNormalizedString类代码示例

本文整理汇总了C#中System.Runtime.Remoting.Metadata.W3cXsd2001.SoapNormalizedString的典型用法代码示例。如果您正苦于以下问题:C# SoapNormalizedString类的具体用法?C# SoapNormalizedString怎么用?C# SoapNormalizedString使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


SoapNormalizedString类属于System.Runtime.Remoting.Metadata.W3cXsd2001命名空间,在下文中一共展示了SoapNormalizedString类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: TestParse

//引入命名空间
using System;
using System.Runtime.Remoting.Metadata.W3cXsd2001;

public class Demo
{
    public static void TestParse(string testString)
    {
        try
        {
            // Parse the test string.
            SoapNormalizedString normalized = 
                SoapNormalizedString.Parse(testString);

            // Report that the parse succeeded if no exception was thrown.
            Console.WriteLine(
                "Parse succeeded on the string \"{0}\".", 
                testString);

            // Print the string representation of the object.
            Console.WriteLine(
                "The normalized value of this string is \"{0}\".",
                normalized.ToString());

            // Print the XSD type of the object.
            Console.WriteLine(
                "The XSD type of the SoapNormalizedString " + 
                "object is {0}.", normalized.GetXsdType());

            // Print the value of the SoapNormalizedString object.
            Console.WriteLine(
                "The value of the SoapNormalizedString " +
                "object is \"{0}\".", 
                normalized.Value);
        }
        catch(System.Runtime.Remoting.RemotingException e)
        {
            // Report the details of the exception that was thrown.
            Console.WriteLine(
                "Parse failed on the string \"{0}\".", 
                testString);
            Console.WriteLine(e.Message);
        }
    }

    public static void Main(string[] args)
    {
        // Create strings to test the Parse method.
        string stringWithSpaces = "one two";
        string stringWithSpacesAndTabs = "one two\t";
        string stringWithSpacesAndLineFeed = "one two\n";
        string stringWithSpacesAndCarriageReturn = "one two\r";

        // Test the Parse method with each string.
        TestParse(stringWithSpaces);
        TestParse(stringWithSpacesAndTabs);
        TestParse(stringWithSpacesAndLineFeed);
        TestParse(stringWithSpacesAndCarriageReturn);

        // Print the XSD type string of the SoapNormalizedString class.
        Console.WriteLine(
            "The XSD type of the SoapNormalizedString class " +
            "is {0}.", SoapNormalizedString.XsdType);
    }
}
开发者ID:.NET开发者,项目名称:System.Runtime.Remoting.Metadata.W3cXsd2001,代码行数:65,代码来源:SoapNormalizedString


注:本文中的System.Runtime.Remoting.Metadata.W3cXsd2001.SoapNormalizedString类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。