Do predefined types have different values in .Net Core?

To answer this question, we will build one Console App .Net Core application in Visual Studio Code installed on Kali Linux distro. The program will introduce us to all types of data, their maximum and minimum values. We will also add a constant to the program and we will see what will get for the results. Then we will check the same code in Visual Studio .Net 2019 Community. But let’s start from beginning. What is programming? Basically, it is a skill for you to tell your computer to behave in a certain way with the code that your computer understands. In order to be involved in programming, it is necessary to have a computer, operating system, Internet connection, IDE – development environment and that you know the certain programming language. In our case, this is C# programming language which we are currently learning. Also, we have Visual Studio Code installed on the Linux operating system and Kali distro installed on an older laptop.

In your case, it may be different. For example, to build .Net Core applications on a different operating system, it’s important to understand that learning C# programming language does not require too many software, hardware and technical costs. Our advice to you is whenever you have an older or less configured computer; install a Linux operating system on it. And use it to learn. In order for your computer to understand your code, you are forwarding commands to your computer in the form of a single line of code or multiple grouped lines of code called statements that the computer understands. You group the statements into methods, methods into classes, and do it as simply, accurately, and without a single mistake. Every piece of code must be without any error, optimized and tested. Also, always try to write the code only once while the same code is used and called repeatedly in the project. But where do the types, variables, their values ​​and constants fit in?

The variables are words that describe a place in memory that contains values ​​that you can change. To understand this, it is best to think of a variable as a small box that stores some value in memory. So, there are various boxes. For example, there is an integer box or an integer type in which you can put an integer value. There is also a decimal box or a decimal type where you can put a decimal value. There is a boolean box that you can only put true or false value. Sometimes you will need to decide is it something true or false. The boolean type is awesome for it. But you can’t put an integer value in a boolean box. So, you put values ​​in specific boxes for that value that store your value in your computer’s RAM – Random Access Memory. This is how the program remembers the data processed.

To control memory usage and data processing speed, you should always consider how much space your variable will use and select the appropriate type for it. But what is a constant? The constant is a special box or special data type that must contain and type. This means that as you create the constant you also specify its type. Variables can change value, but constants cannot. You can add or subtract a number to the variable while the constant is always the same. It is used when you have some value like Pi in mathematics. Its value is 3.14159265359; but lest you constantly write this number whenever you need it in the program; simply create a constant of type Pi of decimal and assign it a value of 3.14159265359. So, when you need this value, you write Pi in your code, while the program knows that the Pi value is the same as if you wrote 3.14159265359. To see how this works, we move on to coding a program that contains predefined types used in the C# programming language.


Continue Reading
Close Menu