Value TypesBefore we go and understand the command structure of C#, I believe that it is important to first understand the data types that are available. Data types are the fundamental blocks of any programming language, some have plenty; others have scarce. Real-world information, such as area and perimeter of a shape, can be represented through a programming language's data type. Like any programming language, C# has some basic data types that comes in-built with the language. You may ask, what makes C# any different from other languages? There is nothing new to C# that other languages cannot have. However, it is in the implementation of these data types that makes a lot of difference. In .Net, all data types are now the same and that is irrespective of any programming language. The Fundamental Problem You can now start to get an appreciation of the problems C# and .Net are trying to address. In C#, types are grouped into two: -
What are value types?
If you're a C/C++ programmer, you'll immediately notice that there are two new types; decimal
and bool. You can use the decimal type to represent monetary or financial
information. It has greater precision than float or double, however the decimal type can hold smaller range.
The copyright of the article Value Types in C# Programming is owned by Jose Aniceto. Permission to republish Value Types in print or online must be granted by the author in writing.
Go To Page: 1 2 Articles in this Topic Discussions in this Topic |