473,387 Members | 1,925 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,387 software developers and data experts.

obsolete New Hashtable(New CaseInsensitiveHashCodeProvider, New CaseInsensitiveComparer), use IEqualityComparer instead

New warning in .net 2.0... The cumbersome, and difficult to remember
case-insensitive comparer declaration for the hashtable has been
deprecated... It tells me to use IEqualityComparer instead.

So, this syntax is obsolete:

New Hashtable(New CaseInsensitiveHashCodeProvider, New
CaseInsensitiveComparer)

So, the replacement seems to be (after an hour of searching):

New Hashtable(StringComparer.OrdinalIgnoreCase)
The following link is helpful as it describes the "why"... At least
this one will be easy to remember.

http://msdn.microsoft.com/library/de...ngsinNET20.asp
Example (vb.net):

Dim d As New Hashtable(StringComparer.OrdinalIgnoreCase)

d.Add("hello", "why do they make this so difficult?")

If d.ContainsKey("HELLO") Then
MsgBox("because")
End If
Hopefully this saves someone else an hour of searching...

Northern State - Is "Georgeous George" a liberal arts, academic,
literary kinda name? Right?

Nov 22 '05 #1
0 3865

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

Similar topics

1
by: Samuel | last post by:
Hi, I used to have this with .NET 1.1: Dim objDict As Hashtable = New Hashtable(New CaseInsensitiveHashCodeProvider(), New CaseInsensitiveComparer()) but when I code the above statement in...
1
by: _eee_ | last post by:
I'm looking for a way to step through a hashtable while adding items to the table (This precludes using enumerators. They don't like HashTable alterations while they are active). There must be an...
2
by: A.M | last post by:
Hi, By default, HashTable.ContainsValue is case sesetive for string datatype. Can I have it non-casesensetive? Thanks Alan
1
by: vertigo | last post by:
Hello I defined: Hashtable chan1 = new Hashtable(new CaseInsensitiveHashCodeProvider(CultureInfo.InvariantCulture), new InvariantComparer()); where: public class InvariantComparer :...
2
by: Brian Keating | last post by:
hi there, has anyone had success in serializing a 2.0 case sensivite hashtable ie. private Hashtable m_itemsById = new Hashtable( new CaseInsensitiveHashCodeProvider(), new...
5
by: Dave | last post by:
Hi all, Is it possible to populate a listbox from a hashtable (complexbind) where the ValueMember of the listbox maps to the "key" member of the hashtable AND the DisplayMember of the listbox maps...
10
by: Q | last post by:
Hi, I'm using a hashtable to store away a bunch of numbers from my array: The Hashtable should look like: Key Value 1 01234 2 01235
5
by: rk2008 | last post by:
I am using Hashtable to keep Key-Value pair of elements. When I add the items to the Hashtable it does not retain the order in which I have added the key-value pair. Is there anyway to retain the...
9
by: raylopez99 | last post by:
Hello all— I’m trying to get the below to work and cannot get the format right. It’s from this example: http://msdn.microsoft.com/en-us/library/8627sbea(VS.71).aspx What it is: I’m trying...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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...

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.