Home > Net >  C # casting
C # casting

Time:09-23

The following for me in c + + used in casting, want in c # to achieve the same function, how to write programs
Float the get;
Char * p;
P=(char *) & amp; The get;

CodePudding user response:

C # is not to play, in order to secure a pointer don't have to

CodePudding user response:

And written in c + + is the same, plus the unsafe mark in the function or class, program compiler option switch can
The namespace test
{
Class Program
{
The unsafe static void Main (string [] args)
{
Float the get=0.432 f;
Char * p;
P=(char *) & amp; The get;
Console. WriteLine (" {0} ", new String (p));
}
}
}

CodePudding user response:

Float f=1.1 f;
Char b=the Convert. ToChar (f);
  •  Tags:  
  • C #
  • Related