當前位置: 首頁>>代碼示例>>C#>>正文


C# ByteBuffer.GetLong方法代碼示例

本文整理匯總了C#中System.ByteBuffer.GetLong方法的典型用法代碼示例。如果您正苦於以下問題:C# ByteBuffer.GetLong方法的具體用法?C# ByteBuffer.GetLong怎麽用?C# ByteBuffer.GetLong使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在System.ByteBuffer的用法示例。


在下文中一共展示了ByteBuffer.GetLong方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: ByteBuffer_GetLongReturnsCorrectData

 public void ByteBuffer_GetLongReturnsCorrectData()
 {
     var buffer = new byte[8];
     buffer[0] = 0x0D;
     buffer[1] = 0x0C;
     buffer[2] = 0x0B;
     buffer[3] = 0x0A;
     buffer[4] = 0x04;
     buffer[5] = 0x03;
     buffer[6] = 0x02;
     buffer[7] = 0x01;
     var uut = new ByteBuffer(buffer);
     Assert.AreEqual(0x010203040A0B0C0D, uut.GetLong(0));
 }
開發者ID:google,項目名稱:flatbuffers,代碼行數:14,代碼來源:ByteBufferTests.cs

示例2: ByteBuffer_GetLongChecksOffset

 public void ByteBuffer_GetLongChecksOffset()
 {
     var buffer = new byte[8];
     var uut = new ByteBuffer(buffer);
     Assert.Throws<ArgumentOutOfRangeException>(() => uut.GetLong(8));
 }
開發者ID:google,項目名稱:flatbuffers,代碼行數:6,代碼來源:ByteBufferTests.cs

示例3: testHet

        private static void testHet(int level, ByteBuffer b)
        {

            int p = b.Position;
            b.Limit = (b.Capacity);
            Show(level, b);
            output.Write("    put:");

            b.PutChar((char)1);
            b.PutChar((char)char.MaxValue);
            output.Write(" char");

            b.PutShort((short)1);
            b.PutShort((short)short.MaxValue);
            output.Write(" short");

            b.PutInt(1);
            b.PutInt(int.MaxValue);
            output.Write(" int");

            b.PutLong((long)1);
            b.PutLong((long)long.MaxValue);
            output.Write(" long");

            b.PutFloat((float)1);
            b.PutFloat((float)float.MinValue);
            b.PutFloat((float)float.MaxValue);
            output.Write(" float");

            b.PutDouble((double)1);
            b.PutDouble((double)double.MinValue);
            b.PutDouble((double)double.MaxValue);
            output.Write(" double");

            output.WriteLine();
            b.Limit = (b.Position);
            b.Position = (p);
            Show(level, b);
            output.Write("    get:");

            ck(b, b.GetChar(), 1);
            ck(b, b.GetChar(), char.MaxValue);
            output.Write(" char");

            ck(b, b.GetShort(), 1);
            ck(b, b.GetShort(), short.MaxValue);
            output.Write(" short");

            ck(b, b.GetInt(), 1);
            ck(b, b.GetInt(), int.MaxValue);
            output.Write(" int");

            ck(b, b.GetLong(), 1);
            ck(b, b.GetLong(), long.MaxValue);
            output.Write(" long");

            ck(b, (long)b.GetFloat(), 1);
            ck(b, (long)b.GetFloat(), unchecked((long)float.MinValue));
            ck(b, (long)b.GetFloat(), unchecked((long)float.MaxValue));
            output.Write(" float");

            ck(b, (long)b.GetDouble(), 1);
            ck(b, (long)b.GetDouble(), unchecked((long)double.MinValue));
            ck(b, (long)b.GetDouble(), unchecked((long)double.MaxValue));
            output.Write(" double");

            output.WriteLine();
        }
開發者ID:ChristopherHaws,項目名稱:lucenenet,代碼行數:68,代碼來源:TestByteBuffer.cs


注:本文中的System.ByteBuffer.GetLong方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。