I am allocating some unmanaged memory in my application via Marshal.AllocHGlobal. I'm then copying a set of bytes to this location and converting the resulting segment of memory to a struct before freeing the memory again via Marshal.FreeHGlobal.
Here's the method:
public static T Deserialize<T>(byte[] messageBytes, int start, int len...
I have some data in a stream which is actually in the format of uint. System.IO.Stream only allows me to read the content out to a byte array, but I don't want to read the bytes and then convert them into a uint array with 1/4 the length of the byte array. I want to read it directly into the memory of the uint array so that it saves time...
Hey all,
I have recently been messing around with SFML, a multimedia library. I use C# so naturally I went for the .Net binding, which you can fetch from the SVN in the latest 2.0 version. After a while of messing around I noticed that my application would sometimes hang up when using the Text object, an object used to draw texture font...
I was considering using UnmanagedMemoryStream rather than MemoryStream for dealing with incoming (and perhaps outgoing?) packets in a network server. What I hope to achieve is less copying of values, and if possible, avoid copying to the heap (too much).
For example, for an incoming packet, one could do:
fixed (byte* p = &data) // wher...