[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.sdk

Inacurate Documentation

decrypted

9/21/2002 5:34:00 AM

Hey All,
I want a Dictionary/Hashtable with a way to call a method, supply the
key, and get the value. The documentation states that all the dictionary
style classes have an Item property capable of taking a key and returning
the associated value.....buut these props don;t actualy exists in any
Dictionary style classes....
I have an ugly ass work around of gertting the enumeration and running
through it until my key matches a key, thus pulling the value....but that is
crap. Am i missing something here?

cheers
-dec


3 Answers

guy

9/21/2002 3:19:00 PM

0

How about Hashtable.ContainsKey?

ms-help://MS.NETFrameworkSDK/cpref/html/frlrfSystemCollectionsHashtableClassContainsKeyTopic.htm

On Fri, 20 Sep 2002 20:34:02 -0700, "decrypted" <decrypted@earthlink.net> wrote:

>Hey All,
> I want a Dictionary/Hashtable with a way to call a method, supply the
>key, and get the value. The documentation states that all the dictionary
>style classes have an Item property capable of taking a key and returning
>the associated value.....buut these props don;t actualy exists in any
>Dictionary style classes....
>I have an ugly ass work around of gertting the enumeration and running
>through it until my key matches a key, thus pulling the value....but that is
>crap. Am i missing something here?
>
>cheers
>-dec
>

Bryce Marshall

9/21/2002 9:43:00 PM

0

I assume you are using C#? Anyway, yes, you are missing something. The
"property" described as Item in the documentation is in fact an Indexer.

From the SDK documentation:
"Indexers allow you to index a class or a struct instance in the same way as
an array".

One key way that an indexer differs from a property is that whilst a
property is identified by its name, an indexer is identified by its
signature.

Therefore:

value = myCollection.Item[key] // Incorrect
value = myCollection[key] // Correct

Hope this helps,

Regards,

Bryce Marshall



"decrypted" <decrypted@earthlink.net> wrote in message
news:#THTxASYCHA.2456@tkmsftngp09...
> Hey All,
> I want a Dictionary/Hashtable with a way to call a method, supply the
> key, and get the value. The documentation states that all the dictionary
> style classes have an Item property capable of taking a key and returning
> the associated value.....buut these props don;t actualy exists in any
> Dictionary style classes....
> I have an ugly ass work around of gertting the enumeration and running
> through it until my key matches a key, thus pulling the value....but that
is
> crap. Am i missing something here?
>
> cheers
> -dec
>
>


Robert Villahermosa [MS]

10/8/2002 11:32:00 PM

0

Check the SDK documentation at:
ms-help://MS.NETFrameworkSDK/cscomp/html/vclrflibspecifyassemblyreferenceloc
ations.htm

There is a Hashtable.ContainsKey Method, a Hashtable.ContainsValue Method...

Hope this helps,


--
Robert Villahermosa [MS]

This posting is provided "AS IS" with no warranties, and confers no rights.



"decrypted" <decrypted@earthlink.net> wrote in message
news:#THTxASYCHA.2456@tkmsftngp09...
> Hey All,
> I want a Dictionary/Hashtable with a way to call a method, supply the
> key, and get the value. The documentation states that all the dictionary
> style classes have an Item property capable of taking a key and returning
> the associated value.....buut these props don;t actualy exists in any
> Dictionary style classes....
> I have an ugly ass work around of gertting the enumeration and running
> through it until my key matches a key, thus pulling the value....but that
is
> crap. Am i missing something here?
>
> cheers
> -dec
>
>