Declaring variables
All applications process data. Data comes in, data is processed, and data goes out.
Data usually comes into our program from files, databases, or user input. Data can be put temporarily in variables that will be stored in the memory of the running program. When the program ends, the data in memory is lost. Data is usually output to files and databases, or to the screen or a printer.
When using variables, you should think about, first, how much space it takes in memory, and, second, how fast it can be processed.
We control this by picking an appropriate type. You can think of simple common types such as int
and double
as being different size storage boxes. A smaller box would take less memory but may not be as fast at being processed. ...
Get C# 7 and .NET Core: Modern Cross-Platform Development - Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.