How is it possible to initialize (with a C# initializer) a list of strings? I have tried with the example below but it's not working.
List<string> optionList = new List<string> { "AdditionalCardPersonAddressType","AutomaticRaiseCreditLimit","CardDeliveryTimeWeekDay" }();
How to declare and initialize a list in C#? List<string> myList = new List<string>() { "one", "two", "three", };
Just remove ()
at the end.
List<string> optionList = new List<string> { "AdditionalCardPersonAdressType", /* rest of elements */ };
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With