Background
Have a very old .Net website that is running .Net Framework 2.5.
A couple of days added a new module to it.
Generics
The new module relies on generics.
Declare List Array
The code looks like this:-
List<int> arrTimeHour12; arrTimeHour12 = new List<int>() { 0, 1, 2, 3 , 4, 5, 6, 7, 8 , 9, 10, 11, 12 };
Error Message
Here is the error message
Error Message – Text
CS1002: ; expected
Error Message – Image
Remediation
Code
List<int> arrTimeHour12; /* arrTimeHour12 = new List<int>() {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12}; */ arrTimeHour12 = new List<int>(); for (int i=0; i<=12;i++) { arrTimeHour12.Add(i); }
Summary
So .Net version 2.0 supports generics.
It just does not support the shorthand declaration and setting values on a single statement:-
List<int> arrTimeMinute = new List<int>(){0, 15, 30, 45};