Reputation: 343
I have the following code :
getAllResult.GroupBy(g => g.OriginatingTransactionID)
.Select(r =>
{
usp_GetAll_Result getAllResult1 = r.Select(x => x).FirstOrDefault();
Bundle bundle = new Bundle
{
BundleName = getAllResult1.BundleName,
BundleStatusCode = getAllResult1.BundleStatusCode,
BundleStatusReasonCode = getAllResult1.BundleStatusReasonCode
};
}).ToList();
I am getting the error while compiling:
The type arguments for method 'System.Linq.Enumerable.Select(System.Collections.Generic.IEnumerable, System.Func)' cannot be inferred from the usage. Try specifying the type arguments explicitly.
Upvotes: 0
Views: 130
Reputation: 33815
.Select()
returns a value. Currently you are not returning anything from your expression.
Just return your bundle.
Bundle bundle = new Bundle
{
BundleName = getAllResult1.BundleName,
BundleStatusCode = getAllResult1.BundleStatusCode,
BundleStatusReasonCode = getAllResult1.BundleStatusReasonCode
};
return bundle;
Upvotes: 6