是否有 VB .NET 等效于 C Fall Through 开关?

Is there a VB .NET equivalent to C Fall Through switch?

这不是这个问题的重复:VB.NET Stacking Select Case Statements together like in Switch C#/Java。这里提供的答案没有回答我的问题。那里的答案是 VB .Net 中有一个自动中断,我知道这一点。我在问是否有任何解决方法。

在 C 中,可以这样做:

int i = 1;
switch (i) {
   case 1 :
     //Do first stuff
     break;
   case 2 :
     //Do second stuff
     //Fall Through
   case 3 :
     //Do third stuff 
     break;
}

基本上

由于在 VB .Net 中每个 Select case 语句的末尾都有一个自动中断,有谁知道如何在 VB .Net 中实现这一点?

我的意思是用一种漂亮而漂亮的方式...

你的前提是错误的。在 C# 中,如果当前案例有语句,则不能跳转到下一个案例。尝试这样做会导致编译错误。

但是,您可以 (ab) 使用 goto case 来实现此功能。

switch(0)
{
    case 0:
        Console.WriteLine("0");
        goto case 1;
    case 1:
        Console.WriteLine("1");
        break;

}

VB.Net 有 no equivalent of goto case