范围可能不是正确的词。使用以下代码,我无法访问集合元素的对象属性。是否有更好的返回数据类型或访问这些属性的方法?
protected object Modules()
{
DirectoryInfo di = new DirectoryInfo(Server.MapPath("~/"));
var folders = from x in di.GetDirectories()
where
!(new string[] {
"app_data","bin","obj","scripts","styles","properties"
}).Contains<string>(x.Name.ToLower())
select new
{
Name = x.Name,
Path = x.FullName
};
return folders
}