Multiline string literal in C#

You can use the @ symbol in front of a string to form a verbatim string literal: You also do not have to escape special characters when you use this method, except for double quotes as shown in Jon Skeet’s answer.

C# compiler error: “not all code paths return a value”

You’re missing a return statement. When the compiler looks at your code, it’s sees a third path (the else you didn’t code for) that could occur but doesn’t return a value. Hence not all code paths return a value. For my suggested fix, I put a return after your loop ends. The other obvious spot – adding an else that had a return value to the if-else-if – … Read more

Adding values to a C# array

You can do this way – Alternatively, you can use Lists – the advantage with lists being, you don’t need to know the array size when instantiating the list. Edit: a) for loops on List<T> are a bit more than 2 times cheaper than foreach loops on List<T>, b) Looping on array is around 2 times cheaper than looping on … Read more

All possible array initialization syntaxes

These are the current declaration and initialization methods for a simple array. Note that other techniques of obtaining arrays exist, such as the Linq ToArray() extensions on IEnumerable<T>. Also note that in the declarations above, the first two could replace the string[] on the left with var (C# 3+), as the information on the right is enough to infer the proper type. … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)