1

i have 2 classes(a form class and a user-control class) and in the form one i have a list. I would like to access that list from the user control class. How can i do it ? i could pass a reference from the form class to the user control class , but i am curious if there is another way ?

Regards, Alexandru Badescu

1
  • is the problem that list is private? Commented Oct 30, 2010 at 8:11

1 Answer 1

2

Passing it as a reference is your best option - this is how you should do it.

It keeps coupling between the user control and the form to a minimum and allows the user control to be used elsewhere.

Sign up to request clarification or add additional context in comments.

2 Comments

do you have any other solutions?
@SaeedAlg - You are assuming immutability. @Badescu Alexandru - The list can be passed as an IEnumerable or converted to a ReadOnlyCollection before being passed.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.