I want to create an array of dynamic objects, similar to the JSON pattern. I am using this to allow my Breadcrumb class take in argumens that define the output characteristics. I am thinking it would look something like this
breadcrumbs.Add(new Breadcrumb() {
Title = "Page name",
Attributes = { class = "myclass", data-info="info stuff" }
});
I would then iterate through this array when I display the breadcrum to output something like this
<a href="" title="Page name" class="myclass" data=info="into stuff">...</a>
The question is can I do this dynamically without creating boiler plate code to sit inbetween i.e. BreadcrumAttribute that may specify the attribute name and then data.
I have seen a similar pattern elsewhere within MVC.NET but cannot remember where it was...