var userData = (from u in DB.user_data
join p in DB.users on u.userid equals p.userid
join s in DB.roles on p.roleid equals s.roleid
where u.deptid == 24
select new UserData()
{
userId = u.id,
RoleName = s.Name,
CreateDate = u.Create_date,
Active = u.Active,
ValidTokens = GetTokencount(-- userdata --) -- how to pass current userdata object here
}).ToList();
以下是我根据逻辑从中获取用户可用计数的全局方法
public int GetTokencount(UserData objUserData)
{
// code to get count goes here
}