Hello, I'm a newbie on C# and I have a question in two parts.
Say I have a class Team that defines name and location. I need to write a method that returns an array of Teams.
My first question is... by best pracitce, should I define this method within my Team class? or should it be out side since its returning an array of teams.... (or it doesn't matter)
My second question is, what's the best way to return an array of objects? ArrayList?

Thanks in advance!!

8 Years
Discussion Span
Last Post by yodito

If not required to use Array or ArrayList, I wouldn't use either. Use a typed list instead: List<> .

I would put the method outside of your Team class, but it really depends on where you intend to store your Team list or array.

The best way to return an array or list of objects depends on how you intend to use the returned object.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.