StringComparison.InvariantCultureIgnoreCase去了哪里?

我正在将C#代码移植到Windowsapp store应用。 令我惊讶的是,以下代码不再起作用:

someString.Equals("someOtherString", StringComparison.InvariantCultureIgnoreCase) 

InvariantCultureInvariantCultureIgnoreCase已从StringComparison删除(*)。

为什么?

我该如何更换它?

编辑:(*)严格来说,它尚未删除 ,它仅适用于Windowsapp store应用。 结果是一样的:你不能使用它。

这些特定选项并没有消失,但Windows Store应用程序不支持它们。

如果您查看MSDN for StringComparison Enumeration,您将看到Portable库或.NET for Windows Store不支持这些特定选项。

Portable Library或Windows Store应用程序支持的唯一选项是:

  • 的CurrentCulture
  • CurrentCultureIgnoreCase
  • 序数词
  • OrdinalIgnoreCase

我不能说出原因,但没有选择“替换”,因为框架内不存在这些值。 您将不得不使用其他存在的选项之一, StringComparison.OrdinalIgnoreCase可能是最容易使用的。

看起来它不支持Windowsapp store应用。

对于Windowsapp store应用,只有可以使用绿色包枚举;

在此处输入图像描述

一般来说,人们在这种情况下使用了OrdinalIgnoreCase

https://github.com/loqu8/sqlite-net/commit/bfa04a6a40b4f62000bb9c57d5517643404c9109