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) 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
229,644 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.