The book uses a very specific scenario where o
is an object that would accept any type. So using the object data type worked. Check the OP for the edit.
I see.
The book uses a very specific scenario where o
is an object that would accept any type. So using the object data type worked. Check the OP for the edit.
A switch statement will let control fall through.
I think even switch
statement doesn’t allow it because every case needs to be terminated with either break
, return
or raise
. One needs to use case goto
if one wants fall thought like behavior:
switch (x)
{
case "One":
Console.WriteLine("One");
goto case "Two";
case "Two":
Console.WriteLine("One or two");
break;
}
C# outlaws this, because the vast majority of case sections do not fall through, and when they do in languages that allow it, it’s often a mistake caused by the developer forgetting to write a break statement (or some other statement to break out of the switch). Accidental fall-through is likely to produce unwanted behavior, so C# requires more than the mere omission of a break: if you want fall-through, you must ask for it explicitly.
Programming C# 10 ~ Ian Griffiths
I see, thank you! I got confused with “control falls through a switch statement” and “C++ style fall through in switch statements”.
n00b Q: Is this similar to Avalonia UI?
He really takes time to explain things. Like if someone takes 10 minutes he takes 40 minutes. And it’s worth it; you just don’t get the info but also the “perspective”.
And here I am learning C# 10 and .NET 6.
True! But being open source and being useful enough are two different things.
I wonder what would be the developer experience be like when developing a cross platform app: .NET vs Flutter
No full fledged open source IDE.
To be fair .NET is open source only recently and Avalonia UI is only catching up. More and more people will discover it eventually.
And Microsoft behaviour is also to be blamed. What is a free and full fledged IDE for .NET? VSCode comes close but is no match to VS.
And web bros will notice once Blazor hits on. It will though, right?
It’s working for me.