472,965 Members | 2,027 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,965 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 4256
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: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
2
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

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.