namespace NullForgivingOperatorNamespace
{
public class NullForgivingOperatorClass
{
public void NullForgivingOperatorMethod()
{
int? x = null;
string s = x?.ToString();
}
}
}
Decompiled code
namespace NullForgivingOperatorNamespace;
public class NullForgivingOperatorClass
{
public void NullForgivingOperatorMethod()
{
string s = ((int)null?).ToString();
}
}
Input code
Decompiled code
the build errors are:
Details
This issue was found when trying to write sample input code for https://github.com/icsharpcode/ILSpy/issues/3180.