Click here to Skip to main content
15,908,115 members
Home / Discussions / C#
   

C#

 
Generalnmake for c# Pin
Mingzhi_8624-Jul-05 1:11
Mingzhi_8624-Jul-05 1:11 
GeneralRe: nmake for c# Pin
Michael P Butler24-Jul-05 2:12
Michael P Butler24-Jul-05 2:12 
GeneralPopulate values in data grid based on few conditions Pin
lovelylooney23-Jul-05 23:14
lovelylooney23-Jul-05 23:14 
GeneralRe: Populate values in data grid based on few conditions Pin
Alomgir Miah24-Jul-05 11:30
Alomgir Miah24-Jul-05 11:30 
GeneralClass... Arrays... Collections... Arg! Pin
MNiece23-Jul-05 17:29
MNiece23-Jul-05 17:29 
GeneralRe: Class... Arrays... Collections... Arg! Pin
Rob Graham23-Jul-05 18:23
Rob Graham23-Jul-05 18:23 
GeneralRe: Class... Arrays... Collections... Arg! Pin
MNiece25-Jul-05 2:23
MNiece25-Jul-05 2:23 
GeneralRe: Class... Arrays... Collections... Arg! Pin
Rob Graham25-Jul-05 3:25
Rob Graham25-Jul-05 3:25 
Note the GetServer function provided in the original example. That retrieves the server stored with the servename passed as a parameter. Hashtable stores by key, rather than index (you can get data by index as well, but this is not particularly useful as the indeces have nothing to do with the order added)
For an arrayslist, the index will be the same as the order added.

items in a hashtable are DictionaryEntry objects: a key and value pair,
and the 'indexer' is the key value (can be any object that supports GetHashCode() and Equals()- string, Int32, etc. wotk fine) the indexer returns a generic object reference to the value originally associated with the key

So, if tbl is the Hashtable name:

//add a new server to the hashtable
Server s1 = new Server("server1");
tbl.Add("server1",s1);
// could also use 
// tbl["Server1"] = s1;

// retreive the server stored with the key "server1"
Server s1  = (server)tbl["server1"];//cast object back to original type

For an Arraylist, indexing is by integer indx, just like an array, and what is
returned is a generic object reference. So, if Arr is the Arraylist of Server objects:

Server s1 = (Server)Arr[0]; //cast object back to original type




Absolute faith corrupts as absolutely as absolute power
Eric Hoffer

All that is necessary for the triumph of evil is that good men do nothing.
Edmund Burke

GeneralDatagrid Pin
Srinivas Jonnalagadda23-Jul-05 7:45
Srinivas Jonnalagadda23-Jul-05 7:45 
GeneralRe: Datagrid Pin
Christian Graus23-Jul-05 11:02
protectorChristian Graus23-Jul-05 11:02 
GeneralRe: Datagrid Pin
Srinivas Jonnalagadda23-Jul-05 13:27
Srinivas Jonnalagadda23-Jul-05 13:27 
GeneralRe: Datagrid Pin
Christian Graus23-Jul-05 13:50
protectorChristian Graus23-Jul-05 13:50 
GeneralRe: Datagrid Pin
Srinivas Jonnalagadda23-Jul-05 16:02
Srinivas Jonnalagadda23-Jul-05 16:02 
GeneralRe: Datagrid Pin
Srinivas Jonnalagadda23-Jul-05 17:47
Srinivas Jonnalagadda23-Jul-05 17:47 
GeneralRe: Datagrid Pin
Christian Graus24-Jul-05 12:51
protectorChristian Graus24-Jul-05 12:51 
GeneralArrayList of value types Pin
Luis Alonso Ramos23-Jul-05 6:53
Luis Alonso Ramos23-Jul-05 6:53 
GeneralRe: ArrayList of value types Pin
KaptinKrunch23-Jul-05 7:26
KaptinKrunch23-Jul-05 7:26 
GeneralRe: ArrayList of value types Pin
Wyxlwiis23-Jul-05 7:45
Wyxlwiis23-Jul-05 7:45 
GeneralRe: ArrayList of value types Pin
Luis Alonso Ramos23-Jul-05 8:27
Luis Alonso Ramos23-Jul-05 8:27 
GeneralRe: ArrayList of value types Pin
DavidNohejl23-Jul-05 8:45
DavidNohejl23-Jul-05 8:45 
GeneralRe: ArrayList of value types Pin
Luis Alonso Ramos23-Jul-05 9:38
Luis Alonso Ramos23-Jul-05 9:38 
GeneralRe: ArrayList of value types Pin
Wyxlwiis23-Jul-05 10:11
Wyxlwiis23-Jul-05 10:11 
GeneralRe: ArrayList of value types Pin
Luis Alonso Ramos23-Jul-05 15:10
Luis Alonso Ramos23-Jul-05 15:10 
GeneralRe: ArrayList of value types Pin
LongRange.Shooter25-Jul-05 10:17
LongRange.Shooter25-Jul-05 10:17 
QuestionConnection Database? Pin
pmasknguyen23-Jul-05 6:01
pmasknguyen23-Jul-05 6:01 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.