473,411 Members | 2,185 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,411 software developers and data experts.

Case insensitive System.Collections.Generic.Dictionary

Hi

I am doing something like:

Dim MiDict As New System.Collections.Generic.Dictionary(Of String,
MyObject)

how should I change the above so that the string comparison (key) is
done using the case insensitive comparer ?

Thanks you

-Pam

Feb 3 '07 #1
2 5068
Pamala,
Dim MiDict As New System.Collections.Generic.Dictionary(Of String,
MyObject)(StringComparer.CurrentCultureIgnoreCase)

StringComparer has shared properties both case sensitive & case insensitive
comparisons for the current culture, the invariant culture and ordinal

http://msdn2.microsoft.com/en-us/lib...gcomparer.aspx

--
Hope this helps
Jay B. Harlow [MVP - Outlook]
..NET Application Architect, Enthusiast, & Evangelist
T.S. Bradley - http://www.tsbradley.net
"pamela fluente" <pa***********@libero.itwrote in message
news:11**********************@s48g2000cws.googlegr oups.com...
Hi

I am doing something like:

Dim MiDict As New System.Collections.Generic.Dictionary(Of String,
MyObject)

how should I change the above so that the string comparison (key) is
done using the case insensitive comparer ?

Thanks you

-Pam
Feb 4 '07 #2

On 4 Feb, 16:43, "Jay B. Harlow [MVP - Outlook]"
<Jay_Harlow_...@tsbradley.netwrote:
Pamala,
Dim MiDict As New System.Collections.Generic.Dictionary(Of String,
MyObject)(StringComparer.CurrentCultureIgnoreCase)

StringComparer has shared properties both case sensitive & case insensitive
comparisons for the current culture, the invariant culture and ordinal

http://msdn2.microsoft.com/en-us/lib...gcomparer.aspx
Thank you Jay,

just what I needed.

ciao,
>
--
Hope this helps
Jay B. Harlow [MVP - Outlook]
.NET Application Architect, Enthusiast, & Evangelist
T.S. Bradley -http://www.tsbradley.net

"pamela fluente" <pamelaflue...@libero.itwrote in message

news:11**********************@s48g2000cws.googlegr oups.com...
Hi
I am doing something like:
Dim MiDict As New System.Collections.Generic.Dictionary(Of String,
MyObject)
how should I change the above so that the string comparison (key) is
done using the case insensitive comparer ?
Thanks you
-Pam- Nascondi testo tra virgolette -

- Mostra testo tra virgolette -

Feb 4 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Elbert Lev | last post by:
Hi! Here is the problem: I have a dictionary. Keys are strings. How to make dictionary lookup case insensitive? In other words: If dict = {'First":"Bob", "Last":"Tom"}, dict should return...
11
by: Ville Vainio | last post by:
I need a dict (well, it would be optimal anyway) class that stores the keys as strings without coercing the case to upper or lower, but still provides fast lookup (i.e. uses hash table). >> d...
3
by: Szymon Madejczyk | last post by:
example code: public class envtest { public static void Main() { System.Diagnostics.Process proc = System.Diagnostics.Process.GetCurrentProcess(); string env =...
0
by: William Stacey [MVP] | last post by:
Trying to figure out Dictionary<> and using CaseInsensitive Comparer<> like I did with normal Hashtable. The Hashtable can take a case insenstive Comparer and a Case insensitive HashCode provider....
3
by: Adam J. Schaff | last post by:
Hello. I recently noticed that the Sort method of the .NET ArrayList class does not behave as I expected. I expect 'A' < '_' < 'a' (as per their ascii values) but what I got was the opposite....
5
by: Mark Rae | last post by:
Hi, In v1.x, I used to use the following code to create a case-insensitive Hashtable: Hashtable MyHashtable = new Hashtable(CaseInsensitiveHashCodeProvider.Default,...
4
by: Mark Rae | last post by:
Hi, Is it possible to create a case-insensitive List<stringcollection? E.g. List<stringMyList = new List<string>; MyList.Add("MyString"); So that:
3
by: Monty | last post by:
I have a bit of common code that I've been using for a while to return a dictionary collection of dataobjects. I've made some changes to it and other areas of the project, and suddenly I am getting...
0
by: J. Cliff Dyer | last post by:
Please keep the discussion on-list. On Fri, 2008-09-05 at 15:36 +0200, Maric Michaud wrote: That does not get the same behavior as the OP's original solution. The OP's solution retrieves the...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.