C#空语句 [英] C# Empty Statement

查看:335
本文介绍了C#空语句的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

借助 C#语言规范定义的 empty-声明的语法生产,这可以让我做这样的事情:

 静态无效的主要(字串[] args)
{
    ; ; ;
}

为什么微软包括C#语言这个文法生产的?它有一个有用的目的?


解决方案

 而(GetWhitespace(文本流))
    ;

The C# language specification defines the empty-statement grammar production, which allows me to do something like this:

static void Main(string[] args)
{
    ; ; ;
}

Why would Microsoft include this grammar production in the C# language? Does it have a useful purpose?

解决方案

while (GetWhitespace(textStream))
    ;

这篇关于C#空语句的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆