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


C# UTF7Encoding.GetByteCount方法代码示例

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


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

示例1: PosTest2

 public void PosTest2()
 {
     Byte[] bytes;
     Char[] chars = new Char[] { };
     UTF7Encoding UTF7 = new UTF7Encoding();
     int byteCount = UTF7.GetByteCount(chars, 0, 0);
     bytes = new Byte[byteCount];
     int bytesEncodedCount = UTF7.GetBytes(chars, 0, 0, bytes, 0);
     Assert.Equal(0, bytesEncodedCount);
 }
开发者ID:johnhhm,项目名称:corefx,代码行数:10,代码来源:UTF7EncodingGetBytes1.cs

示例2: PosTest1

 public void PosTest1()
 {
     Byte[] bytes;
     Char[] chars = new Char[] {
                     '\u0023',
                     '\u0025',
                     '\u03a0',
                     '\u03a3'  };
     UTF7Encoding UTF7 = new UTF7Encoding();
     int byteCount = UTF7.GetByteCount(chars, 1, 2);
     bytes = new Byte[byteCount];
     int bytesEncodedCount = UTF7.GetBytes(chars, 1, 2, bytes, 0);
 }
开发者ID:johnhhm,项目名称:corefx,代码行数:13,代码来源:UTF7EncodingGetBytes1.cs

示例3: NegTest3

 public void NegTest3()
 {
     Byte[] bytes;
     Char[] chars = new Char[] {
                     '\u0023',
                     '\u0025',
                     '\u03a0',
                     '\u03a3'  };
     UTF7Encoding UTF7 = new UTF7Encoding();
     int byteCount = UTF7.GetByteCount(chars, 1, 2);
     bytes = new Byte[byteCount];
     Assert.Throws<ArgumentOutOfRangeException>(() =>
     {
         int bytesEncodedCount = UTF7.GetBytes(chars, -1, 2, bytes, 0);
     });
 }
开发者ID:johnhhm,项目名称:corefx,代码行数:16,代码来源:UTF7EncodingGetBytes1.cs

示例4: NegTest2

 public void NegTest2()
 {
     Assert.Throws<ArgumentOutOfRangeException>(() =>
     {
         UTF7Encoding UTF7 = new UTF7Encoding();
         UTF7.GetByteCount(_ARRAY_DIRECTCHARS, -1, 1);
     });
 }
开发者ID:johnhhm,项目名称:corefx,代码行数:8,代码来源:UTF7EncodingGetByteCount2.cs

示例5: NegTest1

 public void NegTest1()
 {
     Assert.Throws<ArgumentNullException>(() =>
     {
         UTF7Encoding UTF7 = new UTF7Encoding();
         UTF7.GetByteCount(null, 0, 1);
     });
 }
开发者ID:johnhhm,项目名称:corefx,代码行数:8,代码来源:UTF7EncodingGetByteCount2.cs

示例6: PosTest7

 public void PosTest7()
 {
     UTF7Encoding utf7 = new UTF7Encoding();
     Assert.Equal(c_INT_EMPTYlENGTH, utf7.GetByteCount(_ARRAY_EMPTY, 0, 0));
 }
开发者ID:johnhhm,项目名称:corefx,代码行数:5,代码来源:UTF7EncodingGetByteCount2.cs

示例7: PosTest6

 public void PosTest6()
 {
     UTF7Encoding utf7 = new UTF7Encoding(true);
     Assert.Equal(c_INT_SPECIALCHARSLENGTH, utf7.GetByteCount(_ARRAY_SPECIALCHARS, 0, _ARRAY_SPECIALCHARS.Length));
 }
开发者ID:johnhhm,项目名称:corefx,代码行数:5,代码来源:UTF7EncodingGetByteCount2.cs

示例8: PosTest4

 public void PosTest4()
 {
     Char[] CHARS = { '!', '\"', '#', '$', '%', '&', '*', ';', '<', '=' };
     UTF7Encoding utf7 = new UTF7Encoding(true);
     Assert.Equal(c_INT_OPTIONALCHARSLENTTH, utf7.GetByteCount(_ARRAY_OPTIONALCHARS, 0, c_INT_OPTIONALCHARSLENTTH));
 }
开发者ID:johnhhm,项目名称:corefx,代码行数:6,代码来源:UTF7EncodingGetByteCount2.cs

示例9: PosTest3

 public void PosTest3()
 {
     UTF7Encoding utf7 = new UTF7Encoding();
     Assert.NotEqual(c_INT_OPTIONALCHARSLENTTH, utf7.GetByteCount(_ARRAY_OPTIONALCHARS, 0, c_INT_OPTIONALCHARSLENTTH));
 }
开发者ID:johnhhm,项目名称:corefx,代码行数:5,代码来源:UTF7EncodingGetByteCount2.cs

示例10: PosTest2

 public void PosTest2()
 {
     UTF7Encoding utf7 = new UTF7Encoding(true);
     Assert.Equal(c_INT_DIRECTCHARSLENGTH, utf7.GetByteCount(_ARRAY_DIRECTCHARS, 0, c_INT_DIRECTCHARSLENGTH));
 }
开发者ID:johnhhm,项目名称:corefx,代码行数:5,代码来源:UTF7EncodingGetByteCount2.cs

示例11: NegTest1

 public void NegTest1()
 {
     string source = null;
     Assert.Throws<ArgumentNullException>(() =>
     {
         UTF7Encoding UTF7 = new UTF7Encoding();
         UTF7.GetByteCount(source);
     });
 }
开发者ID:johnhhm,项目名称:corefx,代码行数:9,代码来源:UTF7EncodingGetByteCount1.cs

示例12: PosTest7

 public void PosTest7()
 {
     UTF7Encoding utf7 = new UTF7Encoding();
     Assert.Equal(c_INT_STRINGEMPTYlENGTH, utf7.GetByteCount(String.Empty));
 }
开发者ID:johnhhm,项目名称:corefx,代码行数:5,代码来源:UTF7EncodingGetByteCount1.cs

示例13: PosTest6

 public void PosTest6()
 {
     UTF7Encoding utf7 = new UTF7Encoding(true);
     Assert.Equal(c_INT_SPECIALCHARSLENGTH, utf7.GetByteCount(c_STRING_SPECIALCHARS));
 }
开发者ID:johnhhm,项目名称:corefx,代码行数:5,代码来源:UTF7EncodingGetByteCount1.cs

示例14: PosTest4

 public void PosTest4()
 {
     UTF7Encoding utf7 = new UTF7Encoding(true);
     Assert.Equal(c_INT_OPTIONALCHARSLENTTH, utf7.GetByteCount(c_STRING_OPTIONALCHARS));
 }
开发者ID:johnhhm,项目名称:corefx,代码行数:5,代码来源:UTF7EncodingGetByteCount1.cs

示例15: PosTest1

 public void PosTest1()
 {
     UTF7Encoding utf7 = new UTF7Encoding();
     Assert.Equal(c_INT_DIRECTCHARSLENGTH, utf7.GetByteCount(c_STRING_DIRECTCHARS));
 }
开发者ID:johnhhm,项目名称:corefx,代码行数:5,代码来源:UTF7EncodingGetByteCount1.cs


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