473,666 Members | 2,093 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

getting items from Hashtable

Lee
I am new to the C# language and I am trying to figure out a couple of
things.

1) How do I get the first item from a Hashtable? For example: in VB6
this would be hashTable.item( 1)

2) When I do a foreach(type var in hashTable) the items are
DictionaryEntri es. I was expecting these to be the values. So, do I
do foreach(type var in hashTable.Value s) instead?

Thanks,
Lee
Jul 22 '05 #1
1 1755
Lee wrote:
I am new to the C# language [..]


And why are you posting to a C++ newsgroup? You probably
want microsoft.publi c.dotnet.langua ges.csharp.

V
Jul 22 '05 #2

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

Similar topics

0
341
by: choyk1 | last post by:
I intended to save properties of an object to a Hashtable. In this case, keys and values are not fixed types and I cannot use SortedList. I have no idea what order the .NET framework add items to Hashtable when Add(key, value) method is applied. Monitoring the position items are added, I cannot find if key is the standard or value. I thought basically Hashtable function acts randomly, therefore the order will be changed unexpectedly. ...
8
59511
by: SenthilVel | last post by:
how to get the corresponding values for a given Key in hashtable ??
13
1373
by: Rich B. | last post by:
I have an MDI form with a single child form. I have found a couple of circumstances that appear to cause the framework to leak Int32s, MenuItems, MenuItemCollections and sometimes TRACKMOUSEEVENTs. This happens if I disable/enable a menuitem, add a new menuitem programatically or click on an entry in the mdiList menu. I am disposing the main menu in the child form as well as in the main mdi form, so that's not the issue. I have seen...
4
25910
by: Nadav | last post by:
Hello. I have a Hashtable, to which I insert key and values. When I go over the hashtable with "foreach" later on, the items are not coming out at the order I inserted them. A quickwatch showed that as the items are inserted, they are not arranged in the hash at the order they were inserted by. Is there a way to control that with a hashtable ? I can't even sort it... Thanks
5
1966
by: Macca | last post by:
Hi, I have a number of objects i would like to store in a list like struture. They already have ID's associated with them so i would like to utilise these ids as accessors the list.. At the moment I have approx 10 objects with ids that are spread out, e.g 1, 12, 24, 56, 200,320....
2
2265
by: bandroo | last post by:
Hi Guys How can I modify the items within a hashtable "in situ" so to speak? At the moment, I am locating the item that I want, extracting it, modifying the item, deleting the hashtable item, and then adding back the modified item to hashtable. This seems rather long winded, and surely there must be a simpler way than that.
1
1123
by: mark4asp | last post by:
Is it possible to treat values and items of a DropDownList like a HashTable? My page records the value of the ConsultantName in a label lblConsultant and the ID in a hidden field hidConsultantID If I know the value of the ID: hidConsultantID, how do I lookup the corresponding name, given that I have a DropDownList which maps corresponding ConsultantIDs to their Names for the consultant (ddlConsultant, IDs are values and names are...
5
11269
by: Jen | last post by:
The usual trick to get around the "collection was modified" problem by looping through the collection backwards by index won't work with a Hashtable because there is no way to access by index, right? How do I loop through a Hashtable to selectively remove items?
0
1037
by: bloodsugarsuckerfish | last post by:
Hi all, I have in the ASP.NET cache a Hashtable of items. What seems to be happening,is that some of the actual entries in the hashtable are being removed, perhaps under memory pressure, when what I would have expected is that the actual hashtable be removed. I cannot see an other reason that the items would be removed, other than by the Cache itself.
0
8444
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8869
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8781
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8551
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8639
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6198
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4198
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4368
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2771
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.