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
200,417 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!