我试图获取List中字符串的索引号.我尝试了以下代码:
List<string> Markets = new List<string>() {"HKG", "TYO", "NSE", "STU", "FRA", "LON", "SIN", "MIL", "TSE", "ASX", "STO", "AEX", "MEX", "NSE", "EPA", "SWX", "CVE", "BRU", "SWX"};
int index = Markets.FindIndex("HKG");
Run Code Online (Sandbox Code Playgroud)
出现以下错误:
'System.Collections.Generic.List.FindIndex(System.Predicate <string>)'的最佳重载方法匹配有一些无效参数参数1:无法从'string'转换为'System.Predicate <string>'
知道如何让编译器喜欢这段代码吗?
PS我使用的是QuantShare的C#,应该是.Net 2.0
| 归档时间: |
|
| 查看次数: |
5132 次 |
| 最近记录: |