不受CLR控制的应用程序不受管理。不安全代码或非托管代码是使用指针变量并允许在非托管代码中使用指针的代码块。
以下是代码-
static unsafe void Main(string[] args) {
int x = 100;
int* a = &x;
Console.WriteLine("Data : {0} ", x);
Console.WriteLine("Address : {0}", (int)a);
Console.ReadKey();
}