Operator operator ==
operator ==(NSError, NSError)
Tests whether the underlying pointers for two NSError objects are the same.
Declaration
public static bool operator ==(NSError lhs, NSError rhs)
Parameters
Type | Name | Description |
---|---|---|
NSError | lhs | The NSError to compare with |
NSError | rhs | The NSError to compare with |
Returns
Type | Description |
---|---|
bool | Returns |
Remarks
This only tests whether two NSErrors point to the same object in memory. Two different NSErrors could still be considered equal. See Equals(NSError).
operator ==(NSError?, NSError?)
Tests for equality.
Declaration
public static bool operator ==(NSError? lhs, NSError? rhs)
Parameters
Type | Name | Description |
---|---|---|
NSError? | lhs | The nullable NSError to compare with |
NSError? | rhs | The nullable NSError to compare with |
Returns
Type | Description |
---|---|
bool | Returns true if any of these conditions are met:
-
|
Remarks
This equality operator allows you to compare null
with an NSError to determine whether its
underlying pointer is null. This allows for a more natural comparison with the Objective-C object:
void TestForNull(NSError error)
{
// True if the native NSError object is null.
if (error == null)
{
// Do something with the error
}
}