Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

C# C# Objects Encapsulation and Arrays Null Reference

Pranava Varshan
Pranava Varshan
3,082 Points

Declaring _path as a MapLocation[] type

Should have asked this buy anyway .

How can _path be declared a MapLocation[] ???

Integer has a range . -2,147,483,648 to 2,147,483,647. So integer accept integers form that range.

What does MapLocation[] accept and its range ???

1 Answer

Steven Parker
Steven Parker
218,596 Points

I'm not sure what your first question is asking. A variable can be declared as any possible type. So "_path" is declared as an array of MapLocation objects.

But MapLocation[] accepts a collection of MapLocation objects, and each one contains inside it two integers named "X" and "Y". Both of these have the value range that you indicated. But the practical range is much smaller, as it must be within the limits of the map argument passed when the instance is created.