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) Perform Converting Strings to Integers

Thanitsak Leuangsupornpong
Thanitsak Leuangsupornpong
7,490 Points

What namespace does int class is in?

I am just curious that if the int is the class like Console they also have their namespace like System. I put system in front of the int and remove directive or using System then I get error. It said, " Identifier expected, `int' is a keyword ". I already search for the answer but document made me confused. Thank you in advance!

1 Answer

Steven Parker
Steven Parker
210,131 Points

The term "int" is a special keyword and has no namespace.

However, it essentially serves as a shorthand for System.Int32. So the class you are looking for is indeed in the System namespace, but under the name Int32.

Thanitsak Leuangsupornpong
Thanitsak Leuangsupornpong
7,490 Points

So what you means is "int" have no name space but "int32" have namespace, because int is special keyword, but int32 isn't. Right? Thank you for the answer!