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


C# ByteBuffer.AsDoubleBuffer方法代码示例

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


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

示例1: OutputBuffer

 private static void OutputBuffer(ByteBuffer byteBuffer, Array dst, Type dstType, int dstStartIndex, int dstIndexLength)
 {
     if (dstType == typeof(bool))
     {
         for (var i = 0; i < dstIndexLength; i++)
         {
             dst[dstStartIndex + i] = byteBuffer.Get(i) == 1;
         }
     }
     else if (dstType == typeof(byte))
     {
         //nothing to do, the dst array is wrapped already.
     }
     else if (dstType == typeof(char))
     {
         var charBuffer = byteBuffer.AsCharBuffer();
         charBuffer.Get((char[])dst, dstStartIndex, dstIndexLength);
     }
     else if (dstType == typeof(short))
     {
         var shortBuffer = byteBuffer.AsShortBuffer();
         shortBuffer.Get((short[])dst, dstStartIndex, dstIndexLength);
     }
     else if (dstType == typeof(float))
     {
         var floatBuffer = byteBuffer.AsFloatBuffer();
         floatBuffer.Get((float[])dst, dstStartIndex, dstIndexLength);
     }
     else if (dstType == typeof(int))
     {
         var intBuffer = byteBuffer.AsIntBuffer();
         intBuffer.Get((int[])dst, dstStartIndex, dstIndexLength);
     }
     else if (dstType == typeof(double))
     {
         var doubleBuffer = byteBuffer.AsDoubleBuffer();
         doubleBuffer.Get((double[])dst, dstStartIndex, dstIndexLength);
     }
     else if (dstType == typeof(long))
     {
         var longBuffer = byteBuffer.AsLongBuffer();
         longBuffer.Get((long[])dst, dstStartIndex, dstIndexLength);
     }
     else
     {
         throw new NotImplementedException("System.Buffer.OutputBuffer");
     } 
 }
开发者ID:nguyenkien,项目名称:api,代码行数:48,代码来源:Buffer.cs


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