Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

C# C# Basics (Retired) Console I/O Namespaces

Edward Hwang
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!