1

这是什么,我不明白,如果我在代码块中放入任意字符串,它会抛出一些编译时错误,但如果我放入类似下面的内容,它不会。

  static void Main(string[] args)
    {
        int i = 5;

       ghfhfghfghfghfhfghfhfghfghfghfhfghfghfghghttp://www.google.com
        Console.WriteLine(i.ToString());
        Console.ReadLine();
    }

知道为什么会这样吗?我只是偶然发现它,不知道为什么,可能是我错过了什么。

4

2 回答 2

6

那是一个标签。

看看:最后。

如果:最后去掉。它不会编译

转到并标记

于 2013-09-06T07:55:05.190 回答
4

ghfhfghfghfghfhfghfhfghfghfghfhfghfghfghghttp:是一个标签,因为它后面跟着:.

然后您可以将它与goto语句一起使用:

static void Main(string[] args)
{
    int i = 5;

    ghfhfghfghfghfhfghfhfghfghfghfhfghfghfghghttp://www.google.com
    Console.WriteLine(i.ToString());
    Console.ReadLine();

    goto ghfhfghfghfghfhfghfhfghfghfghfhfghfghfghghttp;
}
于 2013-09-06T07:55:18.720 回答