It is c# version 8.
I have a method Dispatch<T>(T payload)
I also have T1:T, T2:T, ... T8:T
is it possible to rewrite this:
if(data is T1)
Dispatch((T1)data);
if(data is T2)
Dispatch((T2)data);
...
if(data is T8)
Dispatch((T8)data);
so when someone adds T9:T
this part of code do not change at all?
I am aware I can use new switch statement, but it is basically the same.