3 ms·
Not surprisingly, C# worlds the same way with the only exception that you have to declare the variables as “var” but they are still strongly typed
by raw_anon_1111 9mo ago
Not surprisingly, C# worlds the same way with the only exception that you have to declare the variables as “var” but they are still strongly typed
- recursive 9mo agoTechnically you're also allowed to use anonymously typed objects as inferred generic typed parameters in method calls.
- n4r9 9mo agoIt's also not quite as easy to declare and build an array. You can't just write var arr = [ 1, 2, 3]; You have to write something like var arr = new int[] { 1, 2, 3 }; However if you have previously declared `arr` to be of type `int[]` (or another collection type such as `List<int>`), then you can write arr = [ 1, 2, 3 ]; I haven't used TypeScript so don't know if it distinguishes between arrays and lists, and if so how it determines one or the other in inferred types. Would be curious to know.