The community is working on translating this tutorial into Khmer, but it seems that no one has started the translation process for this article yet. If you can help us, then please click "More info".
If you are fluent in Khmer, then please help us - just point to any untranslated element (highlighted with a yellow left border - remember that images should have their titles translated as well!) inside the article and click the translation button to get started. Or have a look at the current translation status for the Khmer language.
If you see a translation that you think looks wrong, then please consult the original article to make sure and then use the vote button to let us know about it.
Please help us by translating the following metadata for the article/chapter, if they are not already translated.
If you are not satisfied with the translation of a specific metadata item, you may vote it down - when it reaches a certain negative threshold, it will be removed. Please only submit an altered translation of a metadata item if you have good reasons to do so!
Data types are used everywhere in a programming language like C#. Because it's a strongly typed language, you are required to inform the compiler about which data types you wish to use every time you declare a variable, as you will see in the chapter about variables. In this chapter we will take a look at some of the most used data types and how they work.
bool is one of the simplest data types. It can contain only 2 values - false or true. The bool type is important to understand when using logical operators like the if statement.
int is short for integer, a data type for storing numbers without decimals. When working with numbers, int is the most commonly used data type. Integers have several data types within C#, depending on the size of the number they are supposed to store.
string is used for storing text, that is, a number of chars. In C#, strings are immutable, which means that strings are never changed after they have been created. When using methods which changes a string, the actual string is not changed - a new string is returned instead.
char is used for storing a single character.
float is one of the data types used to store numbers which can contain decimals.
These are just the most basic data types in C# and I only told you the very basic stuff about them, because it's a pretty dry subject and you may want to see some data types in action before you read more about them. So, move on to the next article, where we'll be using variables to contain data of various types!
Later in this tutorial, we'll go much more in depth with all the various data types found in the .NET framework.