Example 1:
var ca = p.GetCustomAttribute<ConnectorAttribute>();
return ca?.Point.IsEqual(cp) ?? false;
Example 2:
var ca = p.GetCustomAttribute<ConnectorAttribute>();
return (null != ca) && ca.Point.IsEqual(cp);
Question:
- Does the two example return the same result?
- Which one performs better?
- Are there any concerns about thread safety?
Edit: Nobody mention but the title had some error, I've corrected it.
Edit 2: According the comments, 'those code are the same'. For me it is still not as trivial as it seams to be.
The answer here tells that the first part of example 1. creates a Nullable<bool>
type. Is it optimized because of the null-coalescing operator?