This seems to be a very basic question, but I have not been able to find an answer. I'm attempting to define a variable in one of my controller classes in order to take a "DRY" (Don't Repeat Yourself) approach to my [Bind(Include=...)] attribute settings for my action methods.
I'm attempting to do this:
// Make the accessible fields more DRY
List<string> field_access = new List<string>();
field_access.Add("Title");
field_access.Add("Author");
field_access.Add("Genre");
field_access.Add("Level");
...
public ActionResult Create([Bind(Include = field_access)] Song song)
Instead of this:
public ActionResult Create([Bind(Include = "ID,Title,Author,Genre,Level")] Song song)
Here's the error: CS1519 Invalid token '(' in class, struct, or interface member declaration
An guidance would be much appreciated.