473,325 Members | 2,785 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,325 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 4270
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: steve | last post by:
Hi, I just upgraded my php but ran into a problem. Never seen this before. Somehow it seems I lost php file association. When I do a http://localhost/something.php I get a prompt for dowload...
0
by: Stefano Noferi | last post by:
We are pleased to announce the foundation of the Zope Italia Association (AZI - Associazione Zope Italia). It was created by a couple of mailing list users in the last months (since march). ...
6
by: Justin F | last post by:
I have set up file association for my application (VB.Net). I'm having problems getting the filename that was double-clicked. On my machine at work, if the filename being passed in to the...
2
by: David | last post by:
Hi, I am trying to create a two way association between 2 objects. I intended to do it by having a pointer to each other but I am getting compilation errors. At the moment I can create both...
4
by: Rob | last post by:
I have an Access application that allows users to open up certain files from within Access (.doc files with automation, .pdf's with a pdf viewing form). Other formats, we want to use Internet...
1
by: JerryP | last post by:
Hi Experts, from my program I offer the user to launch different files from a directory (normaly in this directory are .txt files) - but sometimes other files may be in there - so if my program...
3
by: Bret Pehrson | last post by:
I'm working on a (non-trivial) project which includes various & numerous objects, some in my direct source control, some not. I'm finding the need to somehow associate one object with another,...
1
by: Doug Bell | last post by:
Hi, Suddenly clicking on an SLN File type will not open Visual Studio on my PC. Not sure what I have done. The association settings still look to be correct but I get an error message saying that...
1
by: Frederik Vanderhaegen | last post by:
Hi, I'm a newbie in c# and have a simple question. How does you have to implement an association class (uml) in c#? Thanks in advance Frederik
1
by: CatchSandeepVaid | last post by:
I have posted this question in hibernate forums also.. As this forum is related to java, i am posting it here also ... In hibernate, presently one-to-one associations are fetched non-lazily... I...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.