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

Vygandas Razhas
PLUS
Vygandas Razhas
Courses Plus Student 2,422 Points

I'm having trouble figuring out what exactly a method, namespace is. Also what is a method call and the hierarchy of it.

The question consists of what is the method calling order of operations, how do we categorize them?

2 Answers

Steven Parker
Steven Parker
218,848 Points

A fully-qualified method name is: namespace.class.method.

All the parts are separated by periods, and only the namespace can contain periods.

So reading right-to-left (:point_left:this way:point_left:), between the parentheses and the last period is the method name, then from there to the previous period is the class name, and everything before that is the namespace (including any other periods).

Patricia Hector
Patricia Hector
42,901 Points

Namespaces are used to organize classes. In C# are tons of namespaces; "System" is one of them. Then, imagine a namespace like a big closet which stores classes. So every single time you declare a namespace at the top of your document by the short way: using System; or by the long way: System.NameOfTheClass.NameOfTheMethod; you have access to all the classes that that namespace stores. Now you are inside the namespace System, so you can use one of their classes like Console, but that class is as well another closet, maybe not as big as the namespace System, and it contains methods like WriteLine(); In conclusion, we have namespaces which contain classes and these classes contain methods. So in order to throw in the console the famous "Hello World," you have to call namespace.class.method(); System.Console.WriteLine("Hello World");

changed comment to answer