unsafe
Unmanaged memory allocation to managed objects
I\'m wondering about the proper way of allocating memory to a pointer (C/C++ style) from within C#.Then, holding onto that memory for an extended period of time.Also, this allocated memory is meant to[详细]
2023-04-12 15:07 分类:问答C# - fixed/inline arrays
I\'m writing a B+-tree implementation in C#, and the tree implementation I chose for my application has a very specific structure which is cache-conscious. To achieve these properties, it has strict l[详细]
2023-04-12 02:05 分类:问答How to determine the size of an instance?
I have set my project to accept unsafe code and have the following helper Class to determine the size of an instance:[详细]
2023-04-10 01:31 分类:问答Calling an UnmanagedFunctionPointer in C# for custom calling conventions
I have a function in a DLL: char __usercall MyUserCallFunction<al>(int arg1<esi>) Because I hate myself I\'d like to call this from within C# using P/Invoke.[详细]
2023-04-07 09:23 分类:问答C# Bitmap image masking using unsafe code
I\'m using the following code to make image masks in C#: for(int x = 0; x < width; x++) { for(int y = 0; y < height; y++)[详细]
2023-04-04 22:44 分类:问答What is the advantage of using the class Unsafe to write atomics over synchronize blocks?
why java Atomics uses sun Unsafe class rather than usi开发者_开发知识库ng synchronize block/volatile?synchronization is much more heavy weight.[详细]
2023-03-28 19:52 分类:问答Simple algorithm to crop empty borders from an image by code?
Currently I\'m seeking for a rather fast and reasonably accurate algorithm in C#/.NET to do these steps in code:[详细]
2023-03-28 07:31 分类:问答How can I ensure T is serializable in a fixed number of bytes?
I\'m writing a generic DataStructure<T> which persists on the disk, and I need to write it such that T is guaranteed to开发者_开发知识库 be serializable in a fixed number of bytes. For example,[详细]
2023-03-27 16:37 分类:问答C#, Is it possible to convert a byte* to byte[] without a copy? What's the fastest way?
I have a large byte[] receiveBuffer from a socket connection that contains multiple packets inside it.[详细]
2023-03-23 21:24 分类:问答Initialize sbyte** in C# unsafe context
How can sbyte** be initialized in C# unsafe context? I need sbyte** parameters; to be filled with three s开发者_StackOverflow中文版trings: \"first\", \"second\", \"third\".Here is a possible solut[详细]
2023-03-21 18:33 分类:问答