哪里有StringComparison.InvariantCultureIgnoreCase到哪里去了? [英] Where has StringComparison.InvariantCultureIgnoreCase gone?

查看:757
本文介绍了哪里有StringComparison.InvariantCultureIgnoreCase到哪里去了?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我移植的C#代码到Windows Store应用。令我惊讶的下面的代码不工作:

I'm porting C# code to a Windows Store App. To my surprise the following code does not work anymore:

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

InvariantCulture的 InvariantCultureIgnoreCase 已经从 StringComparison 删除(*)。

InvariantCulture and InvariantCultureIgnoreCase have been removed(*) from StringComparison.

为什么?

我如何取代它。

编辑:?(*)严格地说,它一直没有的删除的,它仅仅是不可用的为Windows商店应用程序。其结果是一样的:你不能使用它

(*) Strictly speaking, it has not been removed, it is merely not available for Windows Store Apps. The result is the same: You cannot use it.

推荐答案

这些特定的选项还没有到哪里去了,但他们只是不支持通过Windows应用商店的应用程序。

Those specific options have not gone anywhere, but they are just not supported by Windows Store Apps.

如果你看一下MSDN上的 StringComparison枚举你会看到那些特定的选项不被移植库或.NET为Windows应用商店的支持。

If you look at MSDN for StringComparison Enumeration you'll see those specific options are not supported by the Portable library or .NET for Windows Store.

的唯一选项都支持便携式库或Windows Store应用程序:

The only options that are supported for the Portable Library or Windows Store Apps are:


  • 的CurrentCulture

  • CurrentCultureIgnoreCase


  • OrdinalIgnoreCase

  • CurrentCulture
  • CurrentCultureIgnoreCase
  • Ordinal
  • OrdinalIgnoreCase

我不能说为什么,但没有到替换的那些值不框架内存在的选项。你必须用确实存在, StringComparison.OrdinalIgnoreCase 很可能将是最容易与工作其他选项之一工作。

I can't speak for why, but there is not an option to "replace" as those values do not exist within the framework. You'll have to work with one of the other options that do exist, StringComparison.OrdinalIgnoreCase is probably going to be the easiest to work with.

这篇关于哪里有StringComparison.InvariantCultureIgnoreCase到哪里去了?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆