本文整理汇总了C#中HugeInt.Write方法的典型用法代码示例。如果您正苦于以下问题:C# HugeInt.Write方法的具体用法?C# HugeInt.Write怎么用?C# HugeInt.Write使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HugeInt
的用法示例。
在下文中一共展示了HugeInt.Write方法的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);
}
}
示例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()));
}
}
示例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);
}
}