bitconverter

    14热度

    1回答

    我写了我自己的类,它将C#标准原语转换为字节数组。 后来,我看了BitConverter类source,看看专业人员如何做到这一点。 我的代码示例: public static byte[] getBytes(short value) { byte[] bytes = new byte[2]; bytes[0] = (byte)(value >> 8); bytes

    0热度

    1回答

    我是一个完整的初学者在TCP部分,我尝试编写一个主服务器,它应该处理多个500个客户端,并且延迟很小。 这是我第一次尝试,你有什么建议如何改进代码,或者是我的代码完成垃圾! :d 我首先发送一个标记Uint16作为消息大小的指示器 // receive Code! private byte[] indexBuffer = new byte[sizeof(UInt16)]; pr

    2热度

    1回答

    所以我现在正在实施一种密码算法。 而我需要将数据转换为字节,然后将其拆分为64位。我通过使用BitConverter来完成。 但是有时我在消息结尾处没有8个字节,我不知道如何将少于8个字节转换为ulong。 有什么办法可以使用BitConverter来做到吗?我试过移动字节,但它太复杂了,因为我不知道字节的确切数量。

    1热度

    1回答

    当调用Convert.ToDecimal(float number here)时,出现溢出异常。我正在读取一个字节字符串,并希望将字节数组转换为十进制数。 byte[] hexbyte = {45, 6, 7, 29}; float myFloat = BitConverter.ToSingle(hexbyte, 0); //Make sure the float can be conver

    0热度

    1回答

    我在第一步(i = 0)出现“OverflowException”错误。这段代码有什么问题? Dim byteArray As Byte() = { _ 0, 54, 101, 196, 255, 255, 255, 255, 0, 0, _ 0, 0, 0, 0, 0, 0, 128, 0, 202, 154, _ 59, 0, 0, 0, 0, 1, 0

    -4热度

    1回答

    我想知道如何在Excel VBA中使用bitconverter方法。 我想使用BitConverter.ToInt32将每个放置在32位整数中的差分单元中的4个字节转换。 有人可以帮我一个在VBA中使用的例子吗?我认为我在语法上挣扎。 由于

    -5热度

    1回答

    我得到一个错误,当我尝试启动我的C#程序(请不即时通讯不是很好的编程,所以如果你能写简单来说答案,这将不胜感激) byte[] buffer = BitConverter.GetBytes(Convert.ToInt32(value)); PS3.SetMemory(offset, buffer); 这里是有错误的图片 - http://prntscr.com/7s2uq9 错误读取

    -1热度

    2回答

    在C#中短期可转换为字节组这样 public void WriteShort(short value) { WriteBytes(flip(BitConverter.GetBytes(value))); } 我想用C或Objective-C

    0热度

    1回答

    通过List<byte[]>()以下代码迭代然而问题是,由于某些原因,有时lengthBuffer是byteData的不同的大小。 您可以在我打印BitConverter.ToInt32()长度,然后实际byteDataList[i].Length,这两个数字应该是完全一样的,有很多他们的时间DebugPrintInGame方法看,但原因不明给我很多的现在他们都没有。 与它下面这段代码发送数据的长

    -1热度

    2回答

    在Delphi中有没有相当于bitconverter.getbytes? https://msdn.microsoft.com/en-us/library/fk3sts66(v=vs.110).aspx