1.

How To Compile Unsafe Code?

Answer»

For compiling unsafe code, we have to specify the /unsafe COMMAND-line switch with command-line compiler.

For example: to COMPILE a PROGRAM named “myClass.cs” containing unsafe code the command line command is:

csc /unsafe myClass.cs

In Visual Studio IDE at first we need to enable use of unsafe code in the PROJECT properties.

The steps are given bellow:

  1. Open project properties
  2. Click on the Build tab
  3. Select the option “Allow unsafe code”

For compiling unsafe code, we have to specify the /unsafe command-line switch with command-line compiler.

For example: to compile a program named “myClass.cs” containing unsafe code the command line command is:

csc /unsafe myClass.cs

In Visual Studio IDE at first we need to enable use of unsafe code in the project properties.

The steps are given bellow:



Discussion

No Comment Found