Re: Best way to check is a string is in a list?
- From: "Gerrit Beuze" <gerrit[at]modelmaker[dot]demon[dot]nl>
- Date: Mon, 20 Jun 2005 20:30:30 +0200
Yep, that should do it,
Thanks,
Gerrit Beuze
ModelMaker Tools
> The hashtable does support a case insensitive comparer. There is an
> overload of the constructor which you can pass a new instance of a
> CaseInsensitiveComparer and a CaseInsensitiveHashcodeProvider, and this will
> give you what you want for the case-insensitive keys.
>
> Hope this helps.
>
>
> --
> - Nicholas Paldino [.NET/C# MVP]
> - mvp@xxxxxxxxxxxxxxxxxxxxxxxxxxx
>
> "Gerrit Beuze" <gerrit[at]modelmaker[dot]demon[dot]nl> wrote in message
> news:eiUiWCcdFHA.2984@xxxxxxxxxxxxxxxxxxxxxxx
> > Hi all,
> >
> > Using C# 1.1:
> > I need a fast way of determining whether a string is in a list of approx
> > 150 keyword like strings.
> > in two versions: one case-sensitive, the other one case-insenstive.
> >
> > I thought of loading the keywords in a Hastable as Keys with null values,
> > and then use Hastable.ContainsKey(string)
> > but Hashtable does not seem to support case-insentive keys.
> >
> > Linear search using a StringCollection is too slow for what I'm looking
> > for.
> >
> > Any suggestions on the data structure to use?
> > Does the 1.1 framework come with sorted (case insentive) stringlists ?
> >
> > Thanks in advance,
> >
> > Gerrit Beuze
> > ModelMaker Tools
> >
> >
>
>
.
- Follow-Ups:
- References:
- Best way to check is a string is in a list?
- From: Gerrit Beuze
- Re: Best way to check is a string is in a list?
- From: Nicholas Paldino [.NET/C# MVP]
- Best way to check is a string is in a list?
- Prev by Date: Re: Regular expression question
- Next by Date: Re: Web Slideshow
- Previous by thread: Re: Best way to check is a string is in a list?
- Next by thread: Re: Best way to check is a string is in a list?
- Index(es):
Relevant Pages
|