string.Equals(c#)的culture参数何时实际产生影响的示例?

我不完全理解string.Equals的第二个参数,这是因为我找不到任何实际会产生影响的例子.例如,这里给出的示例是相同的,无论第二个参数的值如何(除了IgnoreCase):
http://msdn.microsoft.com/en-us/library/c64xh8f9.aspx

我只是在讨论StringComparison.CurrentCulture,InvariantCulture或Ordinal的值.
我可以理解这些与IgnoreCase等价物之间的区别.

解决方法

This MSDN页面(在.NET Framework中使用字符串的最佳实践)有很多关于使用字符串的信息,以下示例取自它:
using System;
using System.Globalization;
using System.Threading;

public class Example
{
   public static void Main()
   {
      string[] values= { "able","ångström","apple","Æble","Windows","Visual Studio" };
      Array.sort(values);
      displayArray(values);

      // Change culture to Swedish (Sweden).
      string originalCulture = CultureInfo.CurrentCulture.Name;
      Thread.CurrentThread.CurrentCulture = new CultureInfo("sv-SE");
      Array.sort(values);
      displayArray(values);

      // Restore the original culture.
      Thread.CurrentThread.CurrentCulture = new CultureInfo(originalCulture);
    }

    private static void displayArray(string[] values)
    {
      Console.WriteLine("Sorting using the {0} culture:",CultureInfo.CurrentCulture.Name);
      foreach (string value in values)
         Console.WriteLine("   {0}",value);

      Console.WriteLine();
    }
}
// The example displays the following output:
//       Sorting using the en-US culture:
//          able
//          Æble
//          ångström
//          apple
//          Visual Studio
//          Windows
//       
//       Sorting using the sv-SE culture:
//          able
//          Æble
//          apple
//          Windows
//          Visual Studio
//          ångström

相关文章

在要实现单例模式的类当中添加如下代码:实例化的时候:frmC...
1、如果制作圆角窗体,窗体先继承DOTNETBAR的:public parti...
根据网上资料,自己很粗略的实现了一个winform搜索提示,但是...
近期在做DSOFramer这个控件,打算自己弄一个自定义控件来封装...
今天玩了一把WMI,查询了一下电脑的硬件信息,感觉很多代码都...
最近在研究WinWordControl这个控件,因为上级要求在系统里,...