3 ms·
C#'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 co
by Measter 5y ago
C#'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.