Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
The result of the expression is always 'null' of type 'type name'
This warning is caused by a nullable value type expression that always results in null.
The following code generates warning CS0458.
Example
This example illustrates a number of the different operations with nullable value types that will cause this error.
// CS0458.cs
using System;
public class Test
{
public static void Main()
{
int a = 5;
int? b = a + null; // CS0458
int? qa = 15;
b = qa + null; // CS0458
b -= null; // CS0458
int? qa2 = null;
b = qa2 + null; // CS0458
qa2 -= null; // CS0458
}
}
Collaborate with us on GitHub
The source for this content can be found on GitHub, where you can also create and review issues and pull requests. For more information, see our contributor guide.