Getting an error, hopefully that can be fixed.
I have a Strongly typed list (or at least I am attempting to use one rather...) It only contains 2 properties... NodeName (string), NodeValue(string)
The error I am getting is when trying to add to said list:
_Results.Add(New Calculator01.ResultTyping() With {.NodeName = "Number_Departures_Per_Day", .NodeValue = DC_NDPD.ToString()})
Is producing the following error:
error BC32017: Comma, ')', or a valid expression continuation expected.
Yes, this is an inherited .Net 2.0 website, and no, I cannot upgrade it to a newer version. (I asked the boss already)
I am open to using a different generic collection though, so long as I can strongly type it...
Object Initializers were introduced with Visual Studio 2008 so they were simply not available in .NET 2.
But you can use this syntax:
If you want one line you should provide an appropriate constructor which is a good thing in general:
Now you can use this code: