␡
- Types
- Control Structures
- Object Members
- Events and Delegates
- Object Semantics
- Summary
Like this article? We recommend
Control Structures
A C# switch statement can accept integral, enum, or string values. Java accepts only integral values and definitely doesn't look like this C# switch statement:
string bar = "Zulu"; switch (bar) { case "Alpha": // do something break; case "Beta": // do something break; case "Charlie": // do something break; default: break; }
Borrowed from Visual Basic, the C# foreach loop provides fast-forward read-only iteration through an array or collection class. You won't see the following code in Java:
decimal[] foo = new decimal[] { 1.2m, 3.4m, 5.6m }; foreach (decimal amount in foo) { Console.WriteLine(" " + amount); }