I am trying to get some information about stack arrays in C #, and the only way to allocate this type of buffer is to use unsafe code
char* buffer = stackalloc char[16];
As a workaround, I can create a character structure.
struct Buffer16 { public char c1,c2 //to 16 }
Is there a way to make the buffer not by creating a new type. Create at runtime.
You can always point to pointers or structures of a primitive type:
char* buffer = stackalloc char[16]; int* i = (int*) buffer; long* l = (long*) buffer; byte* b = (byte*) buffer; Point* p = (Point*) buffer;
So you have all the flexibility. You can also use the Marshal.PtrToStructurereverse without using unsafe code.
Marshal.PtrToStructure
Does this answer your question?
, , .
#, , , CLR , . , , , , , , . , , , , , .
Source: https://habr.com/ru/post/1776578/More articles:XSL-fo Problem with pdf file size - xmlCoreGraphics not found Python on Mac OS - pythonhttps://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1776575/alternatives-to-sql-cursor&usg=ALkJrhjie5jrTYy5E1Vt_kvPg7n-YJB8hQPerl refreshing line reading operator - file-ioКак объявить незаписанный массив в С#? - arraysRDS configuration not available after installing ColdFusion 8 Eclipse extensions - eclipseWriting trash for free / delete - c ++System.Printing.PrintQueue QueueStatus does not update - printingWhat exactly does U + mean and why can't I create a Unicode intermediate string table in my C ++ application? - c ++Array of MongoDB Java drivers - javaAll Articles