Pattern matching via switch?
alexanderheistermann at gmail.com
Sun Mar 15 18:22:47 UTC 2020
On Sunday, 15 March 2020 at 17:55:59 UTC, Steven Schveighoffer
> On 3/14/20 3:04 PM, 12345swordy wrote:
>> switch (object)
>> case Type1 t1:
>> case Type2 t2:
>> case Type3 t3:
> Is this a class object and you are trying to determine at
> runtime which derived type it is and perform an action based on
> that? Or are you trying to switch on the type of a concrete
> It should technically be possible to use the fully qualified
> name to switch on, but I don't think typeid(Type1).name is
> usable as a switch label.
It is an example from c#.
object is the top type in that language.
More information about the Digitalmars-d-learn