I have following class:
class A
{
public IEnumerable Song { get; set; }
}
Then in Index i have code like this:
public ActionResult
{
a.Song = (Path.Combine(Server.MapPath("~/Content/themes/base/songs"),
file)).ToList();
return View();
}
This code is not working how can i add string path to IEnumerable Song? Or is there a better way or other way to do this rather than using IEnumerable?
— I dont understand -ve ratings? It is a legit question?
As i described above i am trying to collect 4 or 5 url’s as string under a.Song.
The above code returs character like 134 char string array. Which is not what i am trying to get. I hope this explaination helps but i still dont understand -ve ratings. Can people who assing -ve rating explain why they did that?
IEnumerable is a sequence Generator from a StateMachine. You cannot add an item by this way for an IEnumerable. But as most of the collections are derived from it, you can assign a collection to it.
This will work.
Here a List is created and the path is added to it.