stringtemplate .net dynamic object

Posted by Mark Milford on Stack Overflow See other posts from Stack Overflow or by Mark Milford
Published on 2010-03-09T17:07:59Z Indexed on 2010/04/16 17:33 UTC
Read the original article Hit count: 451

Filed under:
|
|
|
|

Hi

I am using string template to render some content, but the content may be variable so not sure how to pass it in (using .net / c#)

Basic idea is I have a List> which need to end up as parameters, e.g.

List<KeyValuePair<string, object>> ret = new List<KeyValuePair<string, object>>();
ret.Add(new KeyValuePair<string, object>("elem1", true));
ret.Add(new KeyValuePair(string, object>("elem2", false));

Now I want these to show up in string template as:

$item.elem1$ $item.elem2$

I can get them to be $elem1$ or $elem2$ but i need them inside of a structure. So I in effect need to convince the string template setAttribute that I'm passing in an object with properties elem1 and elem2 when in fact I have a List of KeyValuePairs.

Thanks

© Stack Overflow or respective owner

Related posts about stringtemplate

Related posts about .NET