c# - Assigning pointer to a CLR type to void* using unsafe? -


To assign a signal to an indicator in a code, enter void * The way? Unsecured block?

  var bar = 1; Var foo = new Foo (); Unsafe {Zero * p1 = & amp; times; Zero * p2 = & amp; Foo;  

Or it is possible using only C ++ / CLI:

  System :: text :: stringbilder ^ sb = gcnew system:: text :: StringBuilder (); Zero * P1 = & amp; SB;  

It can not find any way to work in C #

< According to P

Any of the following can be an indicator type:

  • sbyte, byte, short, ushort, int, uint,
  • Any indicator type.
  • Any user-defined structure type that contains only unmanaged type of fields.

There is no way to create an indicator for an example of a class (like pointer for an example of the system .ext.StringBuilder ), Although you can create an indicator for a class member in the fixed context like the following code:

  class test {constant integer x; Int y; Unsafe Static Zero F (int * p) {* p = 1; } Static zero major () {test t = new test (); Int [] A = new int [10]; Unsafe {fixed (int * p = & amp; nbsp; & amp; x); f (p); Fixed (int * p = & amp; nbsp;) F (P); // Indicator to a certain category member (integer * p = & amp; [0]) f (p); Fixed (int * p = a) F (p); }}}  

Comments

Popular posts from this blog

sql - dynamically varied number of conditions in the 'where' statement using LINQ -

asp.net mvc - Dynamically Generated Ajax.BeginForm -

Debug on symbian -