![]() |
| | #1 |
| Registered User Join Date: Nov 2005
Posts: 41
| Enumerator<string> PropertyNames(); How do I do that? When I do GetEnumerator on the Hashtable inside the Properties class, I get a Enumerator<Hashtable.Keys> back. How do I return Enumerator<string>? Code: namespace qwerty
{
Class Properties
{
private Hashtable mHashtable = new Hashtable();
public Enumerator<string> PropertyNames()
{
}
public AddProp(string Name, string Value)
{
mHashtable.Add(Name, Value);
return;
}
}
}
|
| mdoland is offline | |
| | #2 |
| Confused Join Date: Sep 2001 Location: Sweden
Posts: 3,125
| Make your own enumerator class (which implements System.Collections.IEnumerator) which is returned from the properties class. It should have 3 methods: Reset, MoveNext and Current.get. To allow your properties class to be used directly in an foreach statement make sure it implements System.Collections.IEnumerable.
__________________ MagosX.com Give a man a fish and you feed him for a day. Teach a man to fish and you feed him for a lifetime. |
| Magos is offline | |
![]() |
| Thread Tools | |
| Display Modes | |
|
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Advantages of c++ type casting over c type casting | kaibalya2008 | C++ Programming | 10 | 05-05-2009 11:09 AM |
| load gif into program | willc0de4food | Windows Programming | 14 | 01-11-2006 10:43 AM |
| casting the system exstracted date into seperate ints | bazzano | C Programming | 1 | 08-30-2005 12:17 AM |
| Type casting | Lionmane | C Programming | 28 | 08-20-2005 02:16 PM |
| question about casting pointers/other types also?? | newbie02 | C++ Programming | 3 | 08-07-2003 05:01 AM |