So I never gave a solution to this problem and thought I might do that real fast.
If you recall, this was the main sticking point of creating a Func for a select clause:
Func<User, EHH??> selectUserID = currentUser => new { currentUser.ID, currentUser.UserName };
Well there is no one solution to this, but there is an easy and clean solution:
public class UserQueryItem { public UserQueryItem ( Int32 userID, String userName ) { UserID = userID; UserName = userName; } public Int32 UserID { get; set; } public String UserName { get; set; } }
Create a class to hold the information.
Func<User, UserQueryItem> selectUserID = currentUser => new UserQueryItem { UserID = currentUser.ID, UserName = currentUser.UserName };
Or
Func<User, UserQueryItem> selectUserID = currentUser => new UserQueryItem (currentUser.ID, currentUser.UserName);
Pretty simple, just a little more work.