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


C# Int32.ToBinary方法代码示例

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


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

示例1: WriteInt32

 /// <summary>
 ///     Writes a signed 32-bit integer to the StreamEx.
 /// </summary>
 /// <param name="b">32-bit signed integer.</param>
 /// <param name="seq">Byte sequence a.k.a endianness.</param>
 public void WriteInt32(Int32 b, BitOrder seq = BitOrder.LittleEndian)
 {
     Write(b.ToBinary(seq), 0, 4);
 }
开发者ID:jluchiji,项目名称:libWyvernzora,代码行数:9,代码来源:StreamEx.cs

示例2: TestMultidimensionalArray

        public void TestMultidimensionalArray()
        {
            Int32[,,] array3d = new Int32[2, 2, 3] { { { 1, 2, 3 }, { 4, 5, 6 } },
                { { 7, 8, 9 }, { 10, 11, 12 } } };

            Byte [] binary = array3d.ToBinary <Int32[,,]> ();

            Int32[,,] result = binary.FromBinary <Int32[,,]> ();

            for (Int32 i = 0; i < 2; ++i)
            {
                for (Int32 j = 0; j < 2; ++j)
                {
                    for (Int32 k = 0; k < 3; ++k)
                    {
                        Assert.That (array3d [i,j,k] == result [i,j,k]);
                    }
                }
            }
        }
开发者ID:gitter-badger,项目名称:oats,代码行数:20,代码来源:Tests.cs

示例3: TestNormalValueArray

        public void TestNormalValueArray()
        {
            Int32[] array = new Int32 [6] { 0, 1, 2, 3, 4, 5};

            Byte [] binary = array.ToBinary <Int32[]> ();

            Int32[] result = binary.FromBinary <Int32[]> ();

            for (Int32 i = 0; i < array.Length; ++i)
            {
                Assert.That (array [i] == result [i]);
            }
        }
开发者ID:gitter-badger,项目名称:oats,代码行数:13,代码来源:Tests.cs

示例4: TestJaggedArray

        public void TestJaggedArray()
        {
            Int32[][] jaggedArray = new Int32 [5][];
            jaggedArray [0] = new Int32[2] { 0, 1 };
            jaggedArray [1] = new Int32[4] { 1, 2, 3, 4};
            jaggedArray [2] = new Int32[6] { 2, 3, 4, 5, 6, 7};
            jaggedArray [3] = new Int32[8] { 3, 4, 5, 6, 7, 8, 9, 10};
            jaggedArray [4] = new Int32[10] { 4, 5, 6, 7, 8, 9, 10, 11, 12, 13};

            Byte [] binary = jaggedArray.ToBinary <Int32[][]> ();

            Int32[][] result = binary.FromBinary <Int32[][]> ();

            for (Int32 i = 0; i < jaggedArray.Length; ++i)
            {
                for (Int32 j = 0; j < jaggedArray [i].Length; ++j)
                {
                    Assert.That (jaggedArray [i][j] == result [i][j]);
                }
            }
        }
开发者ID:gitter-badger,项目名称:oats,代码行数:21,代码来源:Tests.cs


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