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


C# HugeInt.Read方法代码示例

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


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

示例1: IntInputOutputStr

        public void IntInputOutputStr()
        {
            using (var a = new HugeInt("0x10123456789ABCDEF0123456789ABCDEF0123456789ABCDEF"))
            using (var b = new HugeInt())
            using (var ms = new MemoryStream())
            {
                a.Value = a ^ 100;
                using (var writer = new StreamWriter(ms, Encoding.UTF8, 1024, true))
                    a.Write(writer);

                ms.Position = 0;

                using (var reader = new StreamReader(ms, Encoding.UTF8, false, 1024, true))
                    b.Read(reader);

                Assert.AreEqual(a, b);
                Assert.AreEqual(ms.Length, ms.Position);
            }
        }
开发者ID:wbhart,项目名称:mpir,代码行数:19,代码来源:IO.cs

示例2: IntInputOutputStrOctal

        public void IntInputOutputStrOctal()
        {
            using (var a = new HugeInt("0x10123456789ABCDEF0123456789ABCDEF0123456789ABCDEF"))
            using (var b = new HugeInt())
            using (var ms = new MemoryStream())
            {
                a.Value = a ^ 100;
                using (var writer = new StreamWriter(ms, Encoding.UTF8, 1024, true))
                {
                    writer.Write('0');
                    a.Write(writer, 8);
                }

                ms.Position = 0;

                using (var reader = new StreamReader(ms, Encoding.UTF8, false, 1024, true))
                    b.Read(reader);

                Assert.AreEqual(a, b);
                Assert.AreEqual(ms.Length, ms.Position);
                Assert.AreEqual((char)0xFEFF + "0" + a.ToString(8), Encoding.UTF8.GetString(ms.ToArray()));
            }
        }
开发者ID:wbhart,项目名称:mpir,代码行数:23,代码来源:IO.cs

示例3: IntInputOutputRawNegative

 public void IntInputOutputRawNegative()
 {
     using (var a = new HugeInt("0x10123456789ABCDEF0123456789ABCDEF0123456789ABCDEF"))
     using (var b = new HugeInt())
     using (var ms = new MemoryStream())
     {
         a.Value = -(a ^ 100);
         a.Write(ms);
         ms.Position = 0;
         b.Read(ms);
         Assert.AreEqual(a, b);
         Assert.IsTrue(b < 0);
         Assert.AreEqual(ms.Length, ms.Position);
     }
 }
开发者ID:wbhart,项目名称:mpir,代码行数:15,代码来源:IO.cs


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