C
C#7mo ago
lukkasz323

I don't understand the error message in context to my code

List<List<int>> maze = new() { { 0, 1 }, { 2, 3 } };
List<List<int>> maze = new() { { 0, 1 }, { 2, 3 } };
This line of code results in CS1501 No overload for method 'Add' takes 2 arguments. My syntax is probably wrong, but wtf is going on the Error List?
2 Replies
MODiX
MODiX7mo ago
Zeth
sharplab.io (click here)
List<List<int>> maze = [ [ 0, 1 ], [ 2, 3 ] ];
Console.WriteLine(JsonSerializer.Serialize(maze));
List<List<int>> maze = [ [ 0, 1 ], [ 2, 3 ] ];
Console.WriteLine(JsonSerializer.Serialize(maze));
Try the /sharplab command! | React with ❌ to remove this embed.
lukkasz323
lukkasz3237mo ago
thanks a lot