You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Oct 12, 2022. It is now read-only.
using System;
namespace BoxingDemo {
class Program {
static void Main(string[] args) {
double salary = 1200;
string text = "Salary " + salary;
Console.WriteLine(text);
}
}
}
You get a warning that there is boxing on line 8, see screenshot.
This warning is correct if you compile your code in Visual Studio 2017. But the compiler has changed in 2019. I examined the IL code in SharpLab,io and you don't get any boxing any more. The value type is first converted to a string using ToString() (IL line 12) and then concatenated (IL line 17).
I think this warning is in Visual Studio 2019 incorrect.
BTW: I love the tool.
The text was updated successfully, but these errors were encountered:
Suppose you write the following code
You get a warning that there is boxing on line 8, see screenshot.
This warning is correct if you compile your code in Visual Studio 2017. But the compiler has changed in 2019. I examined the IL code in SharpLab,io and you don't get any boxing any more. The value type is first converted to a string using ToString() (IL line 12) and then concatenated (IL line 17).
I think this warning is in Visual Studio 2019 incorrect.
BTW: I love the tool.
The text was updated successfully, but these errors were encountered: