yazanpro yazanpro - 3 months ago 8
C# Question

Null-conditional Operators Compatibility

The Null-conditional Operators has supposedly been introduced in C# 6.0 (or .NET Framework 4.6). However, my project uses the 4.5.2 version of the framework (C# 5.0). While I'm using Visual Studio 2015, the IDE seems to understand the new notation and compiles/works properly. However, I'm confused about whether the project would still work upon publish. My development machine has 4.6 installed but the production server might not.

In other words, is the Null-conditional Operators really compatible with 4.5.2 or am I missing something?

Answer

C# 6 works on the NET 4.5.1. You don't need .Net 4.6.

For more see Does C# 6.0 work for .NET 4.0?