I have this use case:
using System;
namespace ConsoleApplication11
{
using System.Collections.ObjectModel;
public class Program
{
static void Main(string[] args)
{
var test2 = "Name";
string test1 = "Name";
String test3 = "Name";
Console.WriteLine(test1 + test2 + test3 + "NameNotDefined");
}
}
}
What will do the compiler:
- in this line
Console.WriteLine(test1 + test2 + test3 + "Alugili");
? - with the last one
"NameNotDefined"
?
Did the compiler call ToString()
to each of them and than apply the + Operator?
Any body can please explain to me the difference between the var and String and string and "" and how the complier will interact with them?