C # Insecure code,
When a code block is marked with an unsafe modifier, C # allows pointer variables to be used in functions.
Insecure code or unmanaged code is a code block that uses pointer variables.
The following example illustrates how to use a pointer when the unsafe modifier is used in C:
using System;namespace UnsafeCodeApplication{ class Program { static unsafe void Main(string[] args) { int var = 20; int* p = &var; Console.WriteLine("Data is: {0} ", var); Console.WriteLine("Address is: {0}", (int)p); Console.ReadKey(); } }}
To compile Unsafe code, you must switch to the command line compiler to specify/UnsafeCommand line.
For example, to compile a program named prog1.cs that contains Insecure code, enter the following command in the command line:
csc /unsafe prog1.cs
If you are using Visual Studio IDE, You need to enable Insecure code in the project properties.
The procedure is as follows:
- Double-click the properties node in the Solution Explorer to openProject properties).
- ClickBuildTab.
- Select option"Allow unsafe code".
See http://www.w3cschool.cc/csharp/csharp-unsafe-codes.html
Zookeeper