зеркало из https://github.com/mono/mail-archives.git
97 строки
3.3 KiB
HTML
97 строки
3.3 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
|
|
<HTML>
|
|
<HEAD>
|
|
<TITLE> [Mono-list] Hashtable Item Property
|
|
</TITLE>
|
|
<LINK REL="Index" HREF="index.html" >
|
|
<LINK REL="made" HREF="mailto:jonpryor%40vt.edu">
|
|
<META NAME="robots" CONTENT="index,nofollow">
|
|
|
|
<LINK REL="Previous" HREF="016375.html">
|
|
<LINK REL="Next" HREF="016377.html">
|
|
</HEAD>
|
|
<BODY BGCOLOR="#ffffff">
|
|
<H1>[Mono-list] Hashtable Item Property
|
|
</H1>
|
|
<B>Jonathan Pryor
|
|
</B>
|
|
<A HREF="mailto:jonpryor%40vt.edu"
|
|
TITLE="[Mono-list] Hashtable Item Property">jonpryor@vt.edu
|
|
</A><BR>
|
|
<I>Mon, 13 Oct 2003 21:04:45 -0400</I>
|
|
<P><UL>
|
|
<LI> Previous message: <A HREF="016375.html">[Mono-list] Hashtable Item Property
|
|
</A></li>
|
|
<LI> Next message: <A HREF="016377.html">[Mono-list] Profiler of the runtime
|
|
</A></li>
|
|
<LI> <B>Messages sorted by:</B>
|
|
<a href="date.html#16376">[ date ]</a>
|
|
<a href="thread.html#16376">[ thread ]</a>
|
|
<a href="subject.html#16376">[ subject ]</a>
|
|
<a href="author.html#16376">[ author ]</a>
|
|
</LI>
|
|
</UL>
|
|
<HR>
|
|
<!--beginarticle-->
|
|
<PRE>Let me guess; you're trying to do this:
|
|
|
|
Hashtable h = new Hashtable ();
|
|
h.Item ("foo") = "bar";
|
|
object o = h.Item ("foo");
|
|
|
|
That's the bastardized C#/VB.NET hybrid language syntax. It is not
|
|
valid C# syntax. You want:
|
|
|
|
Hashtable h = new Hashtable ();
|
|
h["foo"] = "bar";
|
|
object o = h["foo"];
|
|
|
|
In other words, use (what looks like) an array access syntax instead of
|
|
using the Item() property.
|
|
|
|
Item() is for languages that don't support operator overloading. C#
|
|
supports operator overloading, and the array-access modifier is the way
|
|
to do what you want.
|
|
|
|
- Jon
|
|
|
|
On Mon, 2003-10-13 at 20:31, Hamza Karamali wrote:
|
|
><i> Has the Item property in System.Collections.Hashtable been implemented?
|
|
</I>><i> Whenever I use it, I get an error like the following:
|
|
</I>><i>
|
|
</I>><i> Complex.cs(90) error CS0119: Expression denotes a `property access' where
|
|
</I>><i> a `method group' was expected
|
|
</I>><i>
|
|
</I>><i> I downloaded the latest version of mcs, peeked in the Hashtable.cs file in
|
|
</I>><i> .../class/corlib/System.Collections and couldn't find an Item property
|
|
</I>><i> defined.
|
|
</I>><i>
|
|
</I>><i> Am I missing something?
|
|
</I>><i>
|
|
</I>><i> Thanks,
|
|
</I>><i>
|
|
</I>><i> Hamza.
|
|
</I>><i>
|
|
</I>><i> _______________________________________________
|
|
</I>><i> Mono-list maillist - <A HREF="mailto:Mono-list@lists.ximian.com">Mono-list@lists.ximian.com</A>
|
|
</I>><i> <A HREF="http://lists.ximian.com/mailman/listinfo/mono-list">http://lists.ximian.com/mailman/listinfo/mono-list</A>
|
|
</I>
|
|
|
|
</PRE>
|
|
<!--endarticle-->
|
|
<HR>
|
|
<P><UL>
|
|
<!--threads-->
|
|
<LI> Previous message: <A HREF="016375.html">[Mono-list] Hashtable Item Property
|
|
</A></li>
|
|
<LI> Next message: <A HREF="016377.html">[Mono-list] Profiler of the runtime
|
|
</A></li>
|
|
<LI> <B>Messages sorted by:</B>
|
|
<a href="date.html#16376">[ date ]</a>
|
|
<a href="thread.html#16376">[ thread ]</a>
|
|
<a href="subject.html#16376">[ subject ]</a>
|
|
<a href="author.html#16376">[ author ]</a>
|
|
</LI>
|
|
</UL>
|
|
</body></html>
|