As I mentioned above, when I say equals
of LINQ to Entities I'm referring specifically to the C # reserved word and not to Equals()
of System.Object
.
Source: equals (C # Reference)
The following example returns all red products.
String color = "Red";
using (AdventureWorksEntities context = new AdventureWorksEntities())
{
var query =
from product in context.Products
where product.Color == color
select new
{
Name = product.Name,
ProductNumber = product.ProductNumber,
ListPrice = product.ListPrice
};
foreach (var product in query)
{
Console.WriteLine("Name: {0}", product.Name);
Console.WriteLine("Product number: {0}", product.ProductNumber);
Console.WriteLine("List price: ${0}", product.ListPrice);
Console.WriteLine("");
}
}
Source: Query expression syntax examples: filtering | Microsoft Docs
Doubt: What is the difference or impact when changing ==
to equals
? When doing this change is the select mounted in the same way?
Note: I'm not referring to the .Equals()
method