Search code examples
c#.netvb.netconfigurationmanager

Translating VB.net to C# (configuration manager issue)


I'm currently working on translating a VB.net program to C# and I'm having an issue with the process.

I'm trying to do the following with ConfigurationManager :

string myNumbers = ConfigurationManager.AppSettings("ClientNumbers");    

Where ClientNumbers is a list<string> which works in VB.net but presents me with a "Method, delegate or event is expected" error in C#. I'm not sure why that is and I can't seem to find an answer using my Googling skills.

Thanks, in advance, for any assistance.


Solution

  • simply:

    string myNumbers = ConfigurationManager.AppSetings["ClientNumber"];
    

    you need to use the C# indexer which is a square bracket.