【发布时间】:2010-10-25 06:34:17
【问题描述】:
我似乎无法解决这个问题...请帮忙,谢谢你 vm!
我有一个通用的功能集合。每个功能都有一个 FeatureId 和 FeatureName。我需要将 featureids 传递给 IEnumerable<string>。
我以为我很接近这个:
Listing.Features.ToArray().Cast<string>().AsEnumerable();
甚至尝试像“MacGyver”一样
var sb = new System.Text.StringBuilder();
foreach (Feature f in Listing.Features)
{
sb.AppendFormat("{0}", f.FeatureId);
}
SelectedFeatures = sb.ToString().ToArray();
SelectedFeatures 是 IEnumerable<string>。
我接近了吗?我更喜欢第一次尝试,因为它更干净,但现在我被卡住了,我不再挑剔了
【问题讨论】:
-
Listing.Features对应的type是什么?List?IQueryable?