Code before:
namespace RoslynSandbox
{
public class Foo
{
public Foo()
{
var text = @"Line 1
Line 2";
}
}
}
Fixed code:
namespace RoslynSandbox
{
public class Foo
{
public Foo()
{
#pragma warning disable CS0219 // Variable is assigned but its value is never used
var text = @"Line 1
Line 2"
#pragma warning restore CS0219 // Variable is assigned but its value is never used
;
}
}
}
I would prefer
Fixed code:
namespace RoslynSandbox
{
public class Foo
{
public Foo()
{
#pragma warning disable CS0219 // Variable is assigned but its value is never used
var text = @"Line 1
Line 2";
#pragma warning restore CS0219 // Variable is assigned but its value is never used
}
}
}
The example uses the code fix to suppress CS0219
Code before:
Fixed code:
I would prefer
Fixed code:
The example uses the code fix to suppress
CS0219