我正在尝试创建一个不区分大小写的字符串列表。
CreateList
方法让我传递一些重载:
-
TComparison<System.string>
-
IComparer<System.string>
我尝试使用TStringComparer.OrdinalIgnoreCase
像这样:
var
List: IList<string>;
begin
List := TCollections.CreateList<string>(TStringComparer.OrdinalIgnoreCase);
end;
但是由于这个比较器没有实现上述任何无法编译的类/接口(interface);我得到:
E2250 There is no overloaded version of
TCollections.CreateList<System.string>
that can be called with these arguments
spring4d 框架中是否有可用的实现之一?
最佳答案
你需要写括号:
var
List: IList<string>;
begin
List := TCollections.CreateList<string>(TStringComparer.OrdinalIgnoreCase());
end;
更高版本的编译器可以在没有情况下解决这个问题。
关于delphi - 如何创建不区分大小写的字符串列表?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30308903/