我应该使用'=='的.NET本地化的字符串比较? [英] Should I use '==' for .NET localized string comparisons?

查看:194
本文介绍了我应该使用'=='的.NET本地化的字符串比较?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

什么是不能用==在.NET比较本地化的字符串的原因是什么?如何在问候CultureInfo的比较执行,如果我不使用它?

What are the reasons not to use "==" to compare localized strings in .NET? How would the comparison execute in regards to the CultureInfo if I do use it?

推荐答案

== 是文化不敏感 - 这是一个简单的序号比较。所以两个字符串这是文化上平等的 - 甚至是在其他标准化形式的条款平等 - 可能的没有的是通过等于== 。它基本上把每串像字符阵列。

== is culture-insensitive - it's a simple ordinal comparison. So two strings which are culturally equal - or even equal in terms of other canonicalization forms - may not be equal via ==. It basically treats each string like a char array.

这篇关于我应该使用'=='的.NET本地化的字符串比较?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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