|
|
|
|
|
by foepys
1483 days ago
|
|
The first two are not necessarily equivalent. If your class implements an interface you can type the variable as this interface and have different behavior if the interface methods were declared explicitly [1]. You can also use it to interact with for-each loops and some legacy (2.0 and prior) APIs and save yourself an explicit cast. The last one is a very recently added shorthand which, honestly, I think was just implemented because an intern needed a feature on master to get hired or something like that... I don't get it either. 1: https://docs.microsoft.com/en-us/dotnet/csharp/programming-g... |
|