昨天在我们安装完IDE后,给出了这样的一段尝试代码:
Console.WriteLine("你好,请输入你的名字:");
string str=Console.ReadLine();
Console.WriteLine("你好"+str+",欢迎来到C#的世界");
Console.ReadKey();
那有些同学就很好奇,这些代码外面的是什么呢?
上面这些绿色的东西叫做注释,这些东西不会被编译和执行,就是来告诉你这行代码是干啥的,前期你可能会觉得,这些东西好像并没有什么用,但是如果我给出下面这段代码呢:
using System;
using System.Runtime.InteropServices;
class shoutdown{
[StructLayout(LayoutKind.Sequential, Pack=1)]
internal struct TokPriv1Luid
{
public int Count;
public long Luid;
public int Attr;
}
[DllImport("kernel32.dll", ExactSpelling=true) ]
internal static extern IntPtr GetCurrentProcess();
[DllImport("advapi32.dll", ExactSpelling=true, SetLastError=true) ]
internal static extern bool OpenProcess