Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

When should I use .net Framework data types versus language datatypes?

Tags:

c#

.net

types

When should I use:

Int32 myint = 0;//Framework data type

vs

int myint = 0;//C# language data type

What are the similarities/differences? I seem to recall being told that there are performance differences? Is this true?

like image 900
Nathan Koop Avatar asked Feb 20 '26 23:02

Nathan Koop


1 Answers

In C# the language-defined keywords for data types are just aliases for their respective BCL types. So int is exactly the same as Int32, long is the same as Int64, etc.

In general I'd think it's best to stick with the language-defined type names, though. There are definitely no performance differences as those aliases are resolved by the compiler.

like image 84
Joey Avatar answered Feb 23 '26 13:02

Joey