string + operator vs integer + operator

string str = “123”;
Console.WriteLine(“str={0}”, str + 70); // 12370
Console.WriteLine(“str={0}”, str + “70”); // 12370
int i = 123;
Console.WriteLine(“i={0}”, i + 70); // 193
Console.WriteLine(“i={0}”, i + 70.50); // 193.50 

Leave a Reply

Your email address will not be published. Required fields are marked *