Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/292.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
将VB.net转换为C#(配置管理器问题)_C#_.net_Vb.net_Configurationmanager - Fatal编程技术网

将VB.net转换为C#(配置管理器问题)

将VB.net转换为C#(配置管理器问题),c#,.net,vb.net,configurationmanager,C#,.net,Vb.net,Configurationmanager,我目前正在将一个VB.net程序翻译成C#,我对这个过程有一个问题 我正在尝试使用ConfigurationManager执行以下操作: string myNumbers = ConfigurationManager.AppSettings("ClientNumbers"); 其中ClientNumbers是一个列表,它在VB.net中工作,但在C#中显示了一个“方法、委托或事件是预期的”错误。我不确定这是为什么,我似乎无法用我的谷歌搜索技巧找到答案 提前感谢您的帮助。简单地说: st

我目前正在将一个VB.net程序翻译成C#,我对这个过程有一个问题

我正在尝试使用ConfigurationManager执行以下操作:

string myNumbers = ConfigurationManager.AppSettings("ClientNumbers");    
其中ClientNumbers是一个
列表
,它在VB.net中工作,但在C#中显示了一个“方法、委托或事件是预期的”错误。我不确定这是为什么,我似乎无法用我的谷歌搜索技巧找到答案

提前感谢您的帮助。

简单地说:

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

你需要使用C#索引器,它是一个方括号。

你拼错了方括号

ConfigurationManager.AppSettings["ClientNumbers"]; 

只需使用此链接进行转换

应该是
ConfigurationManager.AppSettings[“ClientNumbers”]关于这个常见的问题,有很多参考资料。在这里不要使用“谷歌搜索”这个词。即使你试图表明你已经尝试了一些研究,SO社区也会把你撕成碎片(指向质疑计票)