我有 dataServiceCollection 并想从中提取一些信息并将其放入字符串中。
private DataServiceCollection<P.Groups> groups;
public DataServiceCollection<P.Groups> Groups()
{
if (groups == null)
{
Uri pRoot = new Uri("http://localhost:19297/WcfDataService1.svc/");
P.Entities data = new P.Entities(pRoot);
var query = (DataServiceQuery<P.Groups>)data.GroupsSet;
groups = new DataServiceCollection<P.Groups>();
groups.LoadAsync(query);
}
return groups;
}
protected override void LoadState(Object navigationParameter, Dictionary<String, Object> pageState)
{
var g = Groups();
this.DefaultViewModel["Groups"] = g;
}
我可以毫无问题地将它绑定到我的 xaml 页面,但我想将“g”放到一个字符串中。