Scope might not be the right word. With the following code I can’t get access to the collections element’s object’s properties. Is there a better return data type or a way to access those properties?
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
}
There are two feasible solutions:
dynamicinstead ofobject. The problem with this is that you lose compile time checking of the code that uses the result of this method.