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# Basics (Retired) Console I/O Namespaces

Edward Hwang
PLUS
Edward Hwang
Courses Plus Student 1,047 Points

Help with Quiz Question 2 of 4 in C# Basics

Why isn't "Illustrator" the name of the namespace in "Adobe.Illustrator.Canvas.Paint()"?

2 Answers

Adam McGrade
Adam McGrade
26,333 Points

Working from right to left, Paint() is the method that belongs to the Canvas class. The Canvas class belongs to the Adobe.Illustrator namespace.

The reason it is Adobe.Illustrator and not just Illustrator, is that there may be other projects that use the Illustrator namespace.

Sometimes you may wish to use a library or package in your project that uses the same namespace as a namespace that is currently in your project. For example you might also have a project with the namespace Illustrator, and you may want to use some classes in the Adobe.Illustrator namespace.

If both were called Illustrator, there would be conflicts as it would be unclear which namespace you were referring to.

In order to make sure that there are no conflicts between the code in the library and your own code, it is best practice to add something like the company name, before the namespace in your project to make it unique.

So you would call your namespace something like MyProject.Illustrator and then be able to use classes belonging to Adobe.Illustrator in your project without issues.

In this case Adobe was added before Illustrator so that it is clear that the classes in that namespace belong to Adobe.Illustrator.

Oğuzhan Emre Özdoğan
Oğuzhan Emre Özdoğan
3,579 Points

there are 3 parts: namespace.class.method(). And note that only namespaces can have periods in them, so Adobe.Illustrator is the name of the namespace. I hope this helps!