.NET ez 2011-11-30
Dictionary 可以不經過大小寫轉換就可以查詢摟!
只需要加上StringComparer.OrdinalIgnoreCase
using System; using System.Collections.Generic; namespace Test { class Program { static void Main(string[] args) { Dictionary<string, string> d = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase) { { "AbCdEfG" , "123456" } }; Console.WriteLine(d["abcdefg"]); } } }
標籤: .NET
本文章網址:
https://www.ez2o.com/Blog/Post/csharp-Dictionary-OrdinalIgnoreCase
https://www.ez2o.com/Blog/Post/58
https://www.ez2o.com/Blog/Post/csharp-Dictionary-OrdinalIgnoreCase
https://www.ez2o.com/Blog/Post/58