Hi OP,
You should implement the interface of IEqualityComparer<Employee> to implement the comparation of Summary and Description, see this sample:
using System.Linq;
using System.Collections.Generic;
namespace MultiCore
{
public class MyComparer : IEqualityComparer<Employee>
{
public bool Equals(Employee x, Employee y)
{
return (x.Summary == y.Summary && x.Description== y.Description);
}
public int GetHashCode(Employee obj)
{
return obj.Summary.GetHashCode() ^ obj.Description.GetHashCode();
}
}
public class Employee
{
public long EmployeeId { get; set; }
public string Summary { get; set; }
public string Description { get; set; }
}
class MainTest
{
static void Main(string[] args)
{
List<Employee> oldemployees = null; //"Assignment" ignored
List<Employee> newemployees = null; //"Assignment" ignored
var differenceResult = oldemployees.Except(newemployees, new MyComparer());
}
}
}
Click For donating:Free Rice For the poor
For spamming-sender issues, you can either report it at Microsoft Spamming Issue , or just find "Report Spam Here+Number" at Forum Issue ;You can also find "Verify Your Account+Number" at "Forum Issue", where you can submit to be confirmed to paste links or images.
For more things to talk about? StackOverFlow is your choice.
No comments:
Post a Comment