A
almurph
Hi,
Hope I have the right forum here - apologies if I don't. I'm trying to
access a ArrayList collection via an indexer inside a class called
"collExample"
What I want to be able to do is to store and retrieve *any* type of
object to the ArrayList. However I am getting conversion errors - Can
anyone helpe me please?
**** CODE AS FOLLOWS *****
public class collExample
{
private System.Collections.ArrayList AL = new
System.Collections.ArrayList();
public System.Collections.ArrayList this[int idx]
{
get
{
return (System.Collections.ArrayList) AL [idx];
}
set
{
AL [idx] = value;
}
}
}// end collExample
I call it then in the following fashion:
collexample CE = new collExample();
CE[0].Add("Banana");
I'm unsure how to call the object though also. Can anyone help me
please?
Thanks,
Al.
Hope I have the right forum here - apologies if I don't. I'm trying to
access a ArrayList collection via an indexer inside a class called
"collExample"
What I want to be able to do is to store and retrieve *any* type of
object to the ArrayList. However I am getting conversion errors - Can
anyone helpe me please?
**** CODE AS FOLLOWS *****
public class collExample
{
private System.Collections.ArrayList AL = new
System.Collections.ArrayList();
public System.Collections.ArrayList this[int idx]
{
get
{
return (System.Collections.ArrayList) AL [idx];
}
set
{
AL [idx] = value;
}
}
}// end collExample
I call it then in the following fashion:
collexample CE = new collExample();
CE[0].Add("Banana");
I'm unsure how to call the object though also. Can anyone help me
please?
Thanks,
Al.