2 ms·
C# added this operator in 2014 with C# 6 ( and the simultaneous release of VS2015.) https://docs.microsoft.com/en-us/dotnet/csharp/whats-new/csharp-version-his
by Jenk 5y ago
C# added this operator in 2014 with C# 6 ( and the simultaneous release of VS2015.)
https://docs.microsoft.com/en-us/dotnet/csharp/whats-new/csharp-version-history#c-version-60 https://docs.microsoft.com/en-us/dotnet/csharp/whats-new/csh...
https://docs.microsoft.com/en-us/archive/msdn-magazine/2014/october/csharp-the-new-and-improved-csharp-6-0 https://docs.microsoft.com/en-us/archive/msdn-magazine/2014/...
Roslyn compiler, also supporting this operator, was released earlier in the same year, too.
- Measter 5y agoC#'s Null-Conditional operator isn't the same as Rust's Try operator. The Try operator will early return from a function, while the Null-Conditional operator conditionally executes the rest of the expression if the receiver isn't null, or else evaluates to null. The equivalent in Rust is the `and_then` method. C# also has a Null-Coalescing operator (`??`) which behaves like Rust's `unwrap_or` method.