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, next, 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 differently sized storage boxes. A smaller box would take less memory but may not be processed as quickly. ...

Get C# 6 and .NET Core 1.0: Modern Cross-Platform Development 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.