I have a query:
var transactions = from t in db.Transactions where t.SellingPrice != 0 select new { t.CommissionPercent, t.SellingPrice };
But in reality, I need to avoid using an anonymous type because it is readonly and select all the properties/columns on my "transaction" item.
I would have thought that it would be something like this:
var transactions = from t in db.Transactions where t.SellingPrice != 0 select t.SellingPrice, t.CommissionPercent, t.Etc...
Or...
var transactions = from t in db.Transactions where t.SellingPrice != 0 select t.SellingPrice select t.CommissionPercent select t.Etc...
Is there no way to retrieve everything the object has for properties and pass it to the Ienumerable?
If you want to avoid anonymous types and get everything, why not just return an IEnumerable
of the original transaction item?
var transactions = from t in db.Transactions where t.SellingPrice != 0 select t;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With