我想使用C#中的LINQ查询将FullName, Email
列值获取到列表中,然后获取这些值,但是它给出了以下错误;
Cannot implicity convert type Systems.Collections.Generic.List<<anoynymous type: string FullName>>
List <PlayerDetails> details = (from x in conn.Table<PlayerDetails>().Where(x => x.Email == emailTextVal).Select(p => new { p.FullName }) select x).ToList();
SoccerAvailability soccerAvailability = new SoccerAvailability();
soccerAvailability.FullName = details[0].FullName;
soccerAvailability.Email = emailTextVal;
答案 0 :(得分:1)
您为什么不选择整个PlayerDetail
记录?
List <PlayerDetails> details = conn.Table<PlayerDetails>().Where(x => x.Email == emailTextVal).ToList();
SoccerAvailability soccerAvailability = new SoccerAvailability();
soccerAvailability.FullName = details[0].FullName;
soccerAvailability.Email = emailTextVal;
或者,您实际上只需要选择FullName
,因为您已经知道电子邮件的值
答案 1 :(得分:1)
您不应将Lambda与C#表达式混淆,我的意思是可以,但是我不建议这样做。 我认为这是您需要的查询:
firebase.database().ref('/users/user_id').update({
a: 50.34132,
b: -1.45345
c: 63,
d: 350
})