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


C# Utf8String.ToString方法代码示例

本文整理汇总了C#中Utf8String.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# Utf8String.ToString方法的具体用法?C# Utf8String.ToString怎么用?C# Utf8String.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Utf8String的用法示例。


在下文中一共展示了Utf8String.ToString方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ToStringPointerTest

 public unsafe void ToStringPointerTest()
 {
     byte[] utf8Bytes = Encoding.UTF8.GetBytes("1258Hello");
     fixed(byte* bytes = utf8Bytes)
     {
         var utf8String = new Utf8String(bytes, utf8Bytes.Length);
         Assert.Equal("1258Hello", utf8String.ToString());
     }
 }
开发者ID:IDisposable,项目名称:corefxlab,代码行数:9,代码来源:BasicUnitTests.cs

示例2: Bug869DoesNotRepro

        //[Fact(Skip = "issue #869")]
        public void Bug869DoesNotRepro()
        {
            var bytes = new byte[] { 0xF0, 0xA4, 0xAD, 0xA2 };
            var utf8String = new Utf8String(bytes);
            var str = "𤭢";
            var strFromUtf8 = utf8String.ToString();

            Assert.Equal(str, strFromUtf8);
        }
开发者ID:jkotas,项目名称:corefxlab,代码行数:10,代码来源:Bugs.cs

示例3: ToStringTest

 public void ToStringTest(string s)
 {
     var utf8string = new Utf8String(Encoding.UTF8.GetBytes(s));
     Assert.Equal(s, utf8string.ToString());
 }
开发者ID:krwq,项目名称:corefxlab,代码行数:5,代码来源:RandomTests.cs

示例4: TestCodePointReverseEnumerator

        private void TestCodePointReverseEnumerator(string s, Utf8String u8s)
        {
            List<UnicodeCodePoint> codePoints = new List<UnicodeCodePoint>();
            Utf8String.CodePointReverseEnumerator it = u8s.CodePoints.GetReverseEnumerator();
            while (it.MoveNext())
            {
                codePoints.Add(it.Current);
            }

            codePoints.Reverse();

            Utf16LittleEndianCodePointEnumerable utf16CodePoints = new Utf16LittleEndianCodePointEnumerable(s);
            Assert.Equal(utf16CodePoints, codePoints);

            Utf8String u8s2 = new Utf8String(codePoints);
            Assert.Equal(u8s, u8s2);
            Assert.Equal(s, u8s2.ToString());
        }
开发者ID:jkotas,项目名称:corefxlab,代码行数:18,代码来源:RandomTests.cs

示例5: StringEqualsConvertedToUtf16String

 public unsafe void StringEqualsConvertedToUtf16String(bool expected, Utf8String s1, Utf8String s2)
 {
     Assert.Equal(expected, s1.Equals(s2.ToString()));
     Assert.Equal(expected, s2.Equals(s1.ToString()));
 }
开发者ID:jkotas,项目名称:corefxlab,代码行数:5,代码来源:RandomTests.cs

示例6: ToString

 public void ToString(string expected, Utf8String s)
 {
     Assert.Equal(expected, s.ToString());
 }
开发者ID:jkotas,项目名称:corefxlab,代码行数:4,代码来源:RandomTests.cs

示例7: ToStringTest

 public unsafe void ToStringTest()
 {
     byte[] utf8Bytes = Encoding.UTF8.GetBytes("1258Hello");
     var utf8String = new Utf8String(utf8Bytes);
     Assert.Equal("1258Hello", utf8String.ToString());
 }
开发者ID:IDisposable,项目名称:corefxlab,代码行数:6,代码来源:BasicUnitTests.cs

示例8: RoundTrip

 public void RoundTrip(string s)
 {
     Utf8String u8s = new Utf8String(s);
     Assert.Equal(s, u8s.ToString());
 }
开发者ID:Applied-Duality,项目名称:corefxlab,代码行数:5,代码来源:RandomTests.cs

示例9: Utf16StringToUtf8StringToUtf16StringRoundTrip

 public void Utf16StringToUtf8StringToUtf16StringRoundTrip(string utf16String)
 {
     Utf8String utf8String = new Utf8String(utf16String);
     Assert.Equal(utf16String, utf8String.ToString());
 }
开发者ID:TerabyteX,项目名称:corefxlab,代码行数:5,代码来源:Utf8Utf16ConversionTests.cs


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