i have this few lines of code
FilterCondition CustomerID = new FilterCondition("Customer_ID",cust.Customer_ID,FilterCondition.FilterOperator.Equals);
List<FilterCondition> conditions = new List<FilterCondition>();
conditions.Add(CustomerID);
conditions.Add(Location_is_last_used);
Location loct = Store.Select<Location>(conditions).First();
I tried to make it work like this
Store.Count<Customer>(new List<FilterCondition>().Add(new FilterCondition("Customer_name",name,FilterCondition.FilterOperator.Equals))
But this wont work because Add returns void and its running me crazy, is there any other way to solve this in one line? i realy dont want to write conditions for everything that i need.
Tnx for help!
Regards,
Luka
You could write an extension method:
You could then invoke this as follows:
(assuming
Store.Count<T>works onICollection<T>, which introduces theCountproperty, otherwise adapt the collection type appropriately.The advantage over the list initializer syntax is that you could use this also for already created list objects (e.g. if you get the list object from a factory method).