// UnSafeSwap.cs // 不安全代码示例 // 编译命令:csc /unsafe UnSafeSwap.cs using System; class Program { public static void Main() { int a = 2; int b = 9; Console.WriteLine("交换前:a = {0}, b = {1}", a, b); // 不安全语句 unsafe { Swap(&a, &b); // 使用了获取变量地址的指针运算符& } Cons
PcapDeviceList devices = SharpPcap.GetAllDevices(); /*If no device exists, print error */ if(devices.Count<1) { Console.WriteLine("No device found on this machine"); return; } int i=0; /* Scan the list printing every entry */ foreach(PcapDevice d