我想在循环中选择每个用户的姓氏并将其显示在文本块中,但是我得到了:System.Linq.Enumerable+WhereSelectListIterator2[PhoneApp1.ServiceREference1.Point,System.String]
。我该如何纠正?
我的WP代码是:
foreach (ServiceReference1.Point o in someList)
{
var text = new TextBlock
{
Text = someList.Select(x => x.surnm).ToString(),
Foreground = new SolidColorBrush(Colors.Orange),
};
}
您已经在循环中并具有对当前对象的引用,因此我看不到您的LINQ查询的原因。这应该可以工作(假设ServiceReference1.Point
具有surnm
):
foreach (ServiceReference1.Point o in someList)
{
var text = new TextBlock
{
Text = o.surnm.ToString(),
Foreground = new SolidColorBrush(Colors.Orange),
};
}
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句