I am building an ASP.NET MVC 3 application, where I have on list of custom objects according to this model:
public class AbnAmroTransaction
{
public int TransactionId { get; set; }
public int AccountNumber { get; set; }
public string Currency { get; set; }
public int TransactionDate { get; set; }
public int InterestDate { get; set; }
public decimal StartBalance { get; set; }
public decimal EndBalance { get; set; }
public decimal Amount { get; set; }
public string Description { get; set; }
public int CategoryId { get; set; }
}
I also have second list with slightly similar objects of custom object type "Transaction" (which I get from my SQL Server 2008 database using a DBML):
Transaction LinqToSql Object
int TransactionId
int ImportId
int CategoryId
DateTime DateTime
Nvarchar(MAX) Currency
Money Amount
Nvarchar(MAX) Description
I'm trying to create a 3rd list that contains all AbnAmroTransactions, where the AbnAmroTransaction.TransactionId is not in the Transactions list (TransactionId). How do I do this without having to loop through both lists, which seems like a very unefficient way to do it?
I have found this article: http://msdn.microsoft.com/en-us/library/system.collections.iequalitycomparer.equals.aspx But that only seems to apply to objects of the same type.