Inequality Operator
Collapse the table of content
Expand the table of content

EntityKey.Inequality Operator (EntityKey, EntityKey)


Compares two EntityKey objects.

Namespace:   System.Data
Assembly:  System.Data.Entity (in System.Data.Entity.dll)

public static bool operator !=(
	EntityKey key1,
	EntityKey key2


Type: System.Data.EntityKey

A EntityKey to compare.

Type: System.Data.EntityKey

A EntityKey to compare.

Return Value

Type: System.Boolean

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

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.

.NET Framework
Available since 3.5
Return to top
© 2015 Microsoft