Edit

Share via


EntityKey.Inequality(EntityKey, EntityKey) Operator

Definition

Compares two EntityKey objects.

public:
 static bool operator !=(System::Data::EntityKey ^ key1, System::Data::EntityKey ^ key2);
public static bool operator != (System.Data.EntityKey key1, System.Data.EntityKey key2);
static member op_Inequality : System.Data.EntityKey * System.Data.EntityKey -> bool
Public Shared Operator != (key1 As EntityKey, key2 As EntityKey) As Boolean

Parameters

key1
EntityKey

A EntityKey to compare.

key2
EntityKey

A EntityKey to compare.

Returns

true if the key1 and key2 values are not equal; otherwise, false.

Remarks

Temporary keys have different comparison semantics than permanent keys:

  • Temporary keys use reference equality. That is, two references to the exact same temporary EntityKey instance are equal but no other EntityKey instances are equal.

  • Permanent keys determine equality based on the values of the contained key properties and the EntitySet. That is, you can have two separate EntityKey instances that are equal if their entity sets are the same and their key values are equal.

In addition, temporary keys have no EntitySet or key values, but regular keys do.

The equivalent method for this operator is EntityKey.Equals(EntityKey).

Applies to