471,344 Members | 1,551 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,344 software developers and data experts.

Implementing a UML association

I have 3 classes - their associations are modelled in UML thus:

Class A: 1 --1..* Class B: 1 --1..* Class C

How would I implement this in C#?

Thanks
Aug 8 '08 #1
4 4201
Paolo wrote:
I have 3 classes - their associations are modelled in UML thus:

Class A: 1 --1..* Class B: 1 --1..* Class C

How would I implement this in C#?
Let A contain a List<Band B contain a List<C>.

And make the code enforce minimum of 1 element,
if that is really important.

Arne
Aug 9 '08 #2
Arne: thank you for the reply. I am new to C# so sorry if this next question
is a bit basic. When I create an instance of Class A I would create a
List<class Bas part of the instantiation. As I create a number of instances
of class B in my application presumably I then have to Add them to the
List<class Bin the class A object?

"Arne Vajhøj" wrote:
Paolo wrote:
I have 3 classes - their associations are modelled in UML thus:

Class A: 1 --1..* Class B: 1 --1..* Class C

How would I implement this in C#?

Let A contain a List<Band B contain a List<C>.

And make the code enforce minimum of 1 element,
if that is really important.

Arne
Aug 10 '08 #3
Paolo wrote:
"Arne Vajhøj" wrote:
>Paolo wrote:
>>I have 3 classes - their associations are modelled in UML thus:

Class A: 1 --1..* Class B: 1 --1..* Class C

How would I implement this in C#?
Let A contain a List<Band B contain a List<C>.

And make the code enforce minimum of 1 element,
if that is really important.
I am new to C# so sorry if this next question
is a bit basic. When I create an instance of Class A I would create a
List<class Bas part of the instantiation. As I create a number of
instances
of class B in my application presumably I then have to Add them to the
List<class Bin the class A object?
The list should be private, so either the B's should be created and
added inside A or something outside A should create them and
call a method in A that does the add.

Arne
Aug 10 '08 #4
Arne: thank you. I shall proceed as you recommend.

"Arne Vajhøj" wrote:
Paolo wrote:
"Arne Vajhøj" wrote:
Paolo wrote:
I have 3 classes - their associations are modelled in UML thus:

Class A: 1 --1..* Class B: 1 --1..* Class C

How would I implement this in C#?
Let A contain a List<Band B contain a List<C>.

And make the code enforce minimum of 1 element,
if that is really important.
I am new to C# so sorry if this next question
is a bit basic. When I create an instance of Class A I would create a
List<class Bas part of the instantiation. As I create a number of
instances
of class B in my application presumably I then have to Add them to the
List<class Bin the class A object?

The list should be private, so either the B's should be created and
added inside A or something outside A should create them and
call a method in A that does the add.

Arne
Aug 10 '08 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

7 posts views Thread by steve | last post: by
reply views Thread by Stefano Noferi | last post: by
2 posts views Thread by David | last post: by
3 posts views Thread by Bret Pehrson | last post: by
1 post views Thread by Doug Bell | last post: by
1 post views Thread by Frederik Vanderhaegen | last post: by
reply views Thread by Ronak mishra | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.