Click here to Skip to main content
15,892,643 members
Home / Discussions / C#
   

C#

 
QuestionAdding SQLCE to Distribution App Pin
Jammer30-Jun-08 1:59
Jammer30-Jun-08 1:59 
AnswerRe: Adding SQLCE to Distribution App Pin
Jammer30-Jun-08 9:20
Jammer30-Jun-08 9:20 
Questionresolving a distribution list in order to send emails Pin
randprin30-Jun-08 1:54
randprin30-Jun-08 1:54 
QuestionArrayList - multi-dimensional and Dynamic Pin
Member 340288630-Jun-08 1:24
Member 340288630-Jun-08 1:24 
AnswerRe: ArrayList - multi-dimensional and Dynamic Pin
DaveyM6930-Jun-08 1:36
professionalDaveyM6930-Jun-08 1:36 
GeneralRe: ArrayList - multi-dimensional and Dynamic Pin
Member 340288630-Jun-08 2:33
Member 340288630-Jun-08 2:33 
GeneralRe: ArrayList - multi-dimensional and Dynamic Pin
DaveyM6930-Jun-08 2:48
professionalDaveyM6930-Jun-08 2:48 
AnswerRe: ArrayList - multi-dimensional and Dynamic [modified] Pin
GuyThiebaut30-Jun-08 5:40
professionalGuyThiebaut30-Jun-08 5:40 
There are different ways of approaching the issue.

What I tend to do is use a list that contains a list as it is more efficient.
However an ArrayList is also fine if you are not too bothered with getting the best performance.

The trick lies in how you retrieve the data.
What you need to do is cast the result from your ArrayList into an Arraylist which you can then work with.

We declare an our main ArrayList:
ArrayList OuterList = new ArrayList();

We then declare our internal ArrayLists adding some data to the ArrayList:
ArrayList InnerList = new ArrayList();
InnerList.Add("SomeData")
InnerList.Add("SomeMoreData")

Then we add InnerList to OuterList so in effect we have an ArrayList of ArrayLists
OuterList.Add(InnerList);

Now the magic comes in extracting the InnerList ArrayLists from OuterList.
We do this by explicitly casting InnerList as an ArrayList as follows:
ArrayList InnerList = (ArrayList)OuterList[Idx]; 

We can then iterate through InnerList pulling all the elements out.

You will need to play with this code to get it to do exactly what you want - it is just for illustrative purposes.
Also there will be better ways of doing things (as this is expensive processor-wise) - it's more a case of if you can grasp the concept of boxing and unboxing(casting) you will have one more very useful bit of C# under you belt.


Continuous effort - not strength or intelligence - is the key to unlocking our potential.(Winston Churchill)


modified on Monday, June 30, 2008 11:47 AM

Questionavoid duplicates in list Pin
cst_kvp30-Jun-08 1:23
cst_kvp30-Jun-08 1:23 
AnswerRe: avoid duplicates in list Pin
DaveyM6930-Jun-08 1:34
professionalDaveyM6930-Jun-08 1:34 
GeneralRe: avoid duplicates in list Pin
cst_kvp30-Jun-08 1:37
cst_kvp30-Jun-08 1:37 
GeneralRe: avoid duplicates in list Pin
Mbah Dhaim30-Jun-08 1:47
Mbah Dhaim30-Jun-08 1:47 
GeneralRe: avoid duplicates in list Pin
DaveyM6930-Jun-08 2:00
professionalDaveyM6930-Jun-08 2:00 
AnswerRe: avoid duplicates in list Pin
Giorgi Dalakishvili30-Jun-08 4:08
mentorGiorgi Dalakishvili30-Jun-08 4:08 
AnswerRe: avoid duplicates in list Pin
Kevin McFarlane30-Jun-08 5:02
Kevin McFarlane30-Jun-08 5:02 
Questionc# point of sale Pin
lankaudaranga30-Jun-08 0:56
lankaudaranga30-Jun-08 0:56 
AnswerRe: c# point of sale PinPopular
Vimalsoft(Pty) Ltd30-Jun-08 1:05
professionalVimalsoft(Pty) Ltd30-Jun-08 1:05 
AnswerRe: c# point of sale Pin
Harvey Saayman30-Jun-08 2:19
Harvey Saayman30-Jun-08 2:19 
RantRe: c# point of sale Pin
Harvey Saayman30-Jun-08 2:43
Harvey Saayman30-Jun-08 2:43 
QuestionHow can I open a hyperlink in a link click from my form in C#.net [modified] Pin
Anu Palavila30-Jun-08 0:47
Anu Palavila30-Jun-08 0:47 
AnswerRe: How can I open a hyperlink in a link click from my web form Pin
Vimalsoft(Pty) Ltd30-Jun-08 1:08
professionalVimalsoft(Pty) Ltd30-Jun-08 1:08 
AnswerRe: How can I open a hyperlink in a link click from my form in C#.net Pin
DaveyM6930-Jun-08 1:26
professionalDaveyM6930-Jun-08 1:26 
GeneralRe: How can I open a hyperlink in a link click from my form in C#.net Pin
Thomas Stockwell30-Jun-08 4:51
professionalThomas Stockwell30-Jun-08 4:51 
QuestionGridviw - my rowCommand does not run Pin
simsen30-Jun-08 0:42
simsen30-Jun-08 0:42 
AnswerRe: Gridviw - my rowCommand does not run Pin
simsen30-Jun-08 0:54
simsen30-Jun-08 0:54 

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.