This documentation is archived and is not being maintained.

Compiler Warning (level 2) CS0458 

Error Message

The result of the expression is always 'null' of type 'type name'

This warning is caused by a nullable expression that always results in null.

The following code generates warning CS0458.


This example illustrates a number of the different operations with nullable 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