|
-
December 21st, 2007, 06:27 AM
#16
Re: ArrayList
 Originally Posted by lsy
i'm looking for something like an array or structure with 1 index hold multiple value! so the index will be my reference point for that particular record or values...
Sounds like you need a multi-dictionary. The free PowerCollections library on codeplex provides such a data structure.
PowerCollections
MultiDictionary
Here's a usage example:
MultiDictionary Example
Last edited by Kevin McFarlane; December 21st, 2007 at 08:47 AM.
Kevin
-
December 21st, 2007, 10:49 AM
#17
Re: ArrayList
 Originally Posted by lsy
i'm looking for something like an array or structure with 1 index hold multiple value! so the index will be my reference point for that particular record or values...
So, a multidimensional array? ;o
Sincerely,
Martin Svendsen
-
December 21st, 2007, 12:54 PM
#18
Re: ArrayList
Sample using hashtable
Code:
private void Form1_Load_1(object sender, System.EventArgs e)
{
Hashtable h = new Hashtable();
h.Add(1, new Student("anis", "khan"));
h.Add(10, new Student("sami", "khan"));
Text = ((Student)h[10]).FirstName;
}
Code:
private struct Student
{
private string m_FirstName;
private string m_LastName;
public Student(string firstName, string lastName)
{
m_FirstName = firstName;
m_LastName = lastName;
}
public object FirstName {
get { return m_FirstName; }
}
public object LastName {
get { return m_LastName; }
}
}
Last edited by aniskhan; December 21st, 2007 at 12:58 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|