Presentation vs Calculation and Evaluation. I love that C# is a typed language. It's great to have to declare if our variable is a
string or an
int or even a
decimal. It's best to use the
char data type when handling numbers that aren't used in mathematical calculations. Phone numbers, postal codes, etc. Same goes for
bool, which should be used only if working with evaluation of true or false.
Variables are temporary storage containers for data.
Assigning a variable is best at the moment of declaration.
string name = "value".
var keyword is used differently than in other languages. Using
var will implicitly give the variable a type at the moment of declaration, which has to be done simultaneously with initialization.
In the C# world by adding
@ at the beginning of the string.
Console.WriteLine(@"Say "hello". Don't escape the /")
String interpolation, similarly to JS, uses the
$ symbol. HOWEVER, it's placed differently. It also uses double quotes instead of backticks.
Combining verbatim and string interpolation can be very useful if you need to escape some characters in your string. In this case,
$@ should be pre-fixed to the string.