I am creating a dictionary in a C# file with the following code:
private readonly Dictionary<string, XlFileFormat> FILE_TYPE_DICT = new Dictionary<string, XlFileFormat> { {"csv", XlFileFormat.xlCSV}, {"html", XlFileFormat.xlHtml} }; There is a red line under new with the error:
Feature 'collection initilializer' cannot be used because it is not part of the ISO-2 C# language specification
What is going on here?
I am using .NET version 2.
.csfile that gets compiled by Visual Studio, or in a.cshtml? Does your project file have alanguageVersionelement?