Solving Error - Unable to Create a Constant Value of type 'System.Object' Only Primitive Types or Enumeration Types are Supported in this Context

Hi All,
 
In the recent course of events, I came across an error message while Comparing two values in my LINQ query.
In my query, I was comparing two int variables using the line:
 x.Equals(y)
 
This line gave me an error : "Unable to create a constant value of type 'System.Object'. Only primitive types or enumeration types are supported in this context."
 
At first, it made me think that maybe the datatype of the two variables are different, but they were not.
Then it occurred to me that both are Int, but one of then if a Nullable Int.
Therefore, in such a situation, LINQ  throws this error.
 
Now, in order to resolve this, I had to alter my LINQ query. We can use any one of the below alternatives:
 
1. x==y
2. x.Value.Equals(y)
 
Either of these worked for me as well. 
 
Hope this helps
 
Thanks
Vipul