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

Nicolai Magnussen
Nicolai Magnussen
224 Points

What is the name of the method Apple.IPhone.Dialer.Dial(string phoneNumber);

What is the name of the method Apple.IPhone.Dialer.Dial(string phoneNumber);

I have tried phoneNumber and string phoneNumber and (string phoneNumber) But none of that works. From the video I learn that you go from right to left. And method is the first on the right.

Example.

StackOverflow.Controllers.CommentController.Details();

CommentControllers is the string, because it's like

Namespace, Class, Method

3 Answers

Steven Parker
Steven Parker
215,987 Points

Things to keep in mind when identifying parts of method names are:

  • The general rule for method names is: namespace.class.method()
  • Only the namespace can contain periods (.)
  • The last two periods separate the namespace from the class and the class from the method
  • Any other periods are part of the namespace.

So the word closest to the parentheses is the method, the word to the left of it is the class, and everything left of that is the namespace. For example, if you had this:

System.IO.File.Copy(Parameters...);

The method is Copy, the class is File, and the namespace is System.IO.

Aaron Coursolle
Aaron Coursolle
18,014 Points

Hint: "(string phoneNumber)" is a parameter you are passing into the method, not the name of the method itself.