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) Perfect Documentation

Ranvir Sahota
Ranvir Sahota
9,844 Points

Is int an alias for Int32 or is Int32 an alias for int?

This MDN documentation https://msdn.microsoft.com/en-us/library/5kzh1b5w.aspx make out C# to be a reference. So is int an alias for int32 because it's shorter? But in the video, Jeremy states that int32 is an alias for int. Why make an alias that is longer? I don't understand why they would do that. I've read SO articles and they don't make any sense to me. What does the documentation mean by .NET Framework Type, does it add integer functions?

1 Answer

Steven Parker
Steven Parker
216,020 Points

The term int is a keyword that denotes the System.Int32 type.

This is as explained in your MSDN reference. I don't think it's an actual "alias" — I think it's a special-case keyword. When the documentation says ".NET Framework Type" they are just showing the full name and namespace of the type int stands for.

Likewise, I don't think int32 is an actual "alias" for int. I think what is meant when this is said is that it is another name that represents the same thing.