Reputation: 11019
My C# code is being run in a older version of C# (4.0.30319.34209) than in my own development environment. I am wondering if my usage of nullable types will work on this older version of C#. Does anyone know what version of C# nullable types were introduced in? My "Google-fu" came up with nothing.
Upvotes: 1
Views: 2116
Reputation: 5703
From here, Nullable
appllies to:
.NET Core
2.2 2.1 2.0 1.1 1.0
.NET Framework
4.8 4.7.2 4.7.1 4.7 4.6.2 4.6.1 4.6 4.5.2 4.5.1 4.5 4.0 3.5 3.0 2.0
.NET Standard
2.0 1.6 1.5 1.4 1.3 1.2 1.1 1.0
Xamarin.Android
7.1
Xamarin.iOS
10.8
Xamarin.Mac
3.0
Upvotes: 2
Reputation: 345
Here is a history of C# versions: https://learn.microsoft.com/en-us/dotnet/csharp/whats-new/csharp-version-history It states that nullable types were introduced in C# v2.0. Hope it helps.
Upvotes: 0
Reputation: 1488
C# 2.0 introduced nullable types that allow you to assign null to value type variables. You can declare nullable types using Nullable where T is a type.
Copied from here: http://www.tutorialsteacher.com/csharp/csharp-nullable-types
Upvotes: 0
Reputation: 1062494
Nullable types are §19.5 in the C# 2.0 specification, so: .NET 2.0 and C# 2.0 (it can't have been earlier, as it depends on "generics", which is definitely 2.0)
Upvotes: 6