FCL Type NamesJuly 8, 2007
After a code review session earlier this week, I was wondering if I am the only one who uses the FCL type names (e.g. Int32) instead of their language-agnostic counterparts (e.g. int). Almost every article or book I’ve read about .NET tends to favor the use of the language specific aliases over the FCL type names (except for the book CLR via C#). Why am I still using the FCL type names?
- One of the first things I've learned about .NET was that it is platform and language independent. I try to adhere to this principle by writing code that is CLS compliant. Although this discussion has nothing to do with being CLS compliant, I find it more clear to use the FCL type names, although they are not recognized by the syntax parsers of Visual Studio for giving them a nice differentiating color. An example of cross-language confusion is that in C#, a long maps to an Int64 while in C++/CLI a long maps to an Int32. I've seen several projects using different .NET languages. With this constant language switching, you have to do some alias switching too. When using the FCL type names, you don't have to worry about using the correct aliases. An Int64 in C# is the same as an Int64 in VB.NET, C++/CLI, ...etc.
- The .NET Framework itself uses the FCL type names as part of method names (e.g. System.Convert.Int64). As a C# developer and a C++/CLI amateur, I find the following line of code rather confusing when using the C++/CLI aliases for the FCL types.
long value = System::Convert::ToInt32(L"12");
I don’t know about you, but I’d rather have the following line of code instead:
Int32 value = System::Convert::ToInt32(L"12");
Am I the only one who sees it like this? Why are the FCL type names not recognized in the code editor of Visual Studio? Why, why, why … do I need a vacation :-) ?
PS: While I was writing this post, Windows Live Writer crashed on me, losing the content of almost the entire post. I’m not amused!
If you and your team want to learn more about how to write maintainable unit tests and get the most out of TDD practices, make sure to have look at our trainings and workshops or check out the books section. Feel free to reach out at email@example.com.
Jan Van Ryswyck
Thank you for visiting my blog. I’m a professional software developer since Y2K. A blogger since Y2K+5. Provider of training and coaching in XP practices. Curator of the Awesome Talks list. Past organizer of the European Virtual ALT.NET meetings. Thinking and learning about all kinds of technologies since forever.
Watch The Videos
June 15, 2022
February 2, 2022
December 15, 2021
October 7, 2021
June 22, 2021
- Behavior-Driven Development
- Concurrent Programming
- Continuous Integration
- Core Skills
- Design Patterns
- Domain-Driven Design
- Event Sourcing
- Fluent Interfaces
- Functional Programming
- Object-Relational Mapping
- Open Source
- Software Design
- Test-Driven Development
- Visual Studio
The opinions expressed on this blog are my own personal opinions. These do NOT represent anyone else’s view on the world in any way whatsoever.
Thank you for visiting my website. I’m a professional software developer since Y2K. A blogger since Y2K+5. Author of Writing Maintainable Unit Tests. Provider of training and coaching in XP practices. Curator of the Awesome Talks list. Thinking and learning about all kinds of technologies since forever.