Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Coding Composition
Message
From
08/08/2007 17:14:54
 
General information
Forum:
ASP.NET
Category:
Class design
Miscellaneous
Thread ID:
01246826
Message ID:
01246905
Views:
15
Fabio,

Yours is a perfect solution, given that class B is a user that could be connected whenever wanted, and could be from 1 to 300000 instances of B.

Although, there will be lot of code to complete the funcionality, the solution that you prupose is the proper one.

Thanks a lot,
enrique




>Hi Enrique,
>
>As Mike had pointed out, you could use ArrayLists or custom collections. You already provided a solution using arrays, which is perfectly valid as well. If you are using .NET 2.0 or superior, another alternative would be to employ generic lists, such as this:
>
>
>public class A
>{
>    IList<B> _listOfB = new List<B>();
>
>    public IList<B> ListOfB
>    {
>        get { return _listOfB;  }
>        set { _listOfB = value; }
>    }
>}
>
>public class B {}
>
>
>To use the agregation you might do the following from the user class:
>
>
>A classA = new A();
>classA.ListOfB.Add(new B());
>classA.ListOfB.Add(new B());
>classA.ListOfB.Add(new B());
>classA.ListOfB.Add(new B());
>
>
>Best regards,
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform