Will this use of List <T> be a miracle or a mess

I want to send meetings to representatives (I spare you the details).

I need to have for each representative a list of the appointments that he performs. I also need the second step to be a list of possible repetitions for each meeting.

I want to compile my data only once. What if I have something like this:

class Rep
{
    int repNumber;
    List<Appointment> availableApps;
}

class Appointment
{
    int appointmentNumber;
    List<Rep> availableReps;
}

Am I running after trouble? It seems wonderful to me, but I see that it can create an endless circle of links.

What do you think? Thanks you

+3
source share
5 answers

I see nothing wrong with that. You see similar classes in the .NET Framework, such as forms and controls, for example:

myControl.childControl.Parent

myControl , .

+4

; .

+5

" ".

, . , ? , , .

+3

. " ", . " ".

, - . . IEquatable GetHashCode: - , .

, , ( ) , , , .. .

+2

; # ( ) , . , , , . , Rep Appointment; , , Appointment. Appointment , Rep ( Rep, Appointment).

+1
source

Source: https://habr.com/ru/post/1796097/


All Articles