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