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

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
231,248 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