0

Hello all,

i want to creat a list of an object
so i used ArrayList in C#


after declaring a class book
i declare the array list as follwing:

private ArrayList mobileStore = new ArrayList();

then i have an object of class , say Mobile

Mobile m1;

and finally i tried to add the object m1 to the array list

mobileStore.Add(m1);
but the error occurs !!


Invalid token '(' in class, struct, or interface member declarationInvalid token ')' in class, struct, or interface member declaration

-------------------

then i tried anoter way :

List<Mobile> store = new List<Mobile>();

but the problem was the same ????


how can i fix it ?

2
Contributors
2
Replies
3
Views
8 Years
Discussion Span
Last Post by CSG-SQU
0

Use curly braces to create a body of class, methods, loop etc.

class Sample
 {
     public void Add()
     {
       //
     }
 }
0

Use curly braces to create a body of class, methods, loop etc.

class Sample
 {
     public void Add()
     {
       //
     }
 }

i already did !!
i have 2 classes !!
one to define the Mobile class with its attributes and properties methods !!
2nd to manipulate information of mobile store !!!


><

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.