Connecting Tech Pros Worldwide Help | Site Map

Implementing a UML association

  #1  
Old August 8th, 2008, 06:25 AM
=?Utf-8?B?UGFvbG8=?=
Guest
 
Posts: n/a
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


  #2  
Old August 9th, 2008, 01:05 AM
=?UTF-8?B?QXJuZSBWYWpow7hq?=
Guest
 
Posts: n/a

re: Implementing a UML association


Paolo wrote:
Quote:
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
  #3  
Old August 10th, 2008, 03:45 AM
=?Utf-8?B?UGFvbG8=?=
Guest
 
Posts: n/a

re: Implementing a UML association


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:
Quote:
Paolo wrote:
Quote:
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
>
  #4  
Old August 10th, 2008, 04:05 AM
=?UTF-8?B?QXJuZSBWYWpow7hq?=
Guest
 
Posts: n/a

re: Implementing a UML association


Paolo wrote:
Quote:
"Arne Vajhøj" wrote:
Quote:
>Paolo wrote:
Quote:
>>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
Quote:
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
  #5  
Old August 10th, 2008, 04:55 AM
=?Utf-8?B?UGFvbG8=?=
Guest
 
Posts: n/a

re: Implementing a UML association


Arne: thank you. I shall proceed as you recommend.

"Arne Vajhøj" wrote:
Quote:
Paolo wrote:
Quote:
"Arne Vajhøj" wrote:
Quote:
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
Quote:
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
>
Closed Thread


Similar Threads
Thread Thread Starter Forum Replies Last Post
Download the JAVA , .NET and SQL Server interview with answers Jobs answers 2 September 26th, 2006 02:25 PM
Download the JAVA , .NET and SQL Server interview PDF Jobs answers 0 September 17th, 2006 02:05 PM
Implementing association class Frederik Vanderhaegen answers 1 February 26th, 2006 01:05 AM
Serialization and interfaces Daniel Faensen answers 2 November 11th, 2005 11:00 PM