473,385 Members | 1,396 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Simple SttrgDictionary Collection

I simply whant to create a key pair, so i'm looking at the specialisted
string dictionary collection, but haven't got a clue how to implement the
two matching values in terms of properties for a control. Can anyone post
sample code on
how to get and set values into the Collection, and how to hook up I'm
assuming it will use the default collection editor or will I have to design
my own?

Cheers

Ric
Jul 20 '06 #1
1 1174
Declaration:

private Dictionary<String, Stringdictionary = new
Dictionary<string,string>();

See if key exists and set values:

if (!dictionary.ContainsKey(fleet.CurrentTrain.TrainI d))
dictionary.Add("X"."111");
else
dictionary["X"] = 222;

Iteration with foreach:

string s = "edbcxed";
foreach (KeyValuePair<string, stringkeyValue in dictionary)
s += keyValue.Value;

Hope it helps.

Jul 20 '06 #2

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

Similar topics

2
by: Preston | last post by:
public Abc test() { if (oneStack.Count != 0) return (Abc)oneStack.Peek(); } I'd like to do return (Abc)oneStack.Peek()first, and then do receiveStack.Pop()
16
by: Mike L | last post by:
This is for a Win form. My combo box DropDownStyle is set to simple. When the user types in a 3 character string in the combo box, the closest item in the collection is shown, right below where...
4
by: bkazlak | last post by:
Hello, I have a quick question might help me understand garbage collection. let's say I'm having a static collection of objects in one class, so this collection should be cached and present...
1
by: Jeff | last post by:
When is the value of an authentication cookie sent from the browser to the server - when the value is read from the Cookies collection? Or, is it possible that the Cookies collection is populated...
3
by: Wayne | last post by:
I need to make a simple grid in which the user can cut and paste the contents of a region of cells from this simple grid to excel. I thought about ganging a bunch of textboxes (1 textbox = 1...
3
by: creator_bob | last post by:
I decided to post here after a little incident where I got an effective memory leak that was immune from garbage collection. I created a simple binary tree, no balancing or deleting. Only two...
6
by: Chris Dunaway | last post by:
The method for printing documents in .Net can be confusing, especially for newer users. I would like to create a way to simplify this process. My idea would be implemented using a PrintDocument...
26
by: nyathancha | last post by:
Hi, How Do I create an instance of a derived class from an instance of a base class, essentially wrapping up an existing base class with some additional functionality. The reason I need this is...
2
by: michelqa | last post by:
Hi, I'm trying to display a list of string in the string collection editor just like the "items" property of an ListBox in VS IDE.... I can find many examples on the net but I cant find any...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.