Hello, thank you for work on SmartFormat it is exactly what I was searching for my project.
Now I try to output a list of arrays of floats and get the value of the items in the array per index:
example:
{Object.ListOfArrays:{0} = first Item in Array, {1} = second Item in Array|; }
This is the data in C# notation:
var Object = new {
ListOfArrays = new List()
{
{1,2},
{1.4,4.12}
}
};
And how I call Smart.Format:
Smart.Format(
"{Object.ListOfArrays:{0} = first Item in Array, {1} = second Item in Array|; }",
new{
Object=Object
});
My expected output is:
1 = first Item in Array, 2 = second Item in Array; 1.4 = first Item in Array, 4.12 = second Item in Array
But instead of getting the items in the arrays back, SmartFormat outputs the first parameter on {0} and nothing on {1} as there is no second parameter. And I perfectly understand why this happens as {0} refers to the first parameter on Smart.Format.
But my question is: Is there any way to access the elements of the arrays per index? Or is this type of nested templates only possible with named selectors like in your examples?
I hope it is understandable what my problem is and maybe someone can help me with this issue.
Hello, thank you for work on SmartFormat it is exactly what I was searching for my project.
Now I try to output a list of arrays of floats and get the value of the items in the array per index:
example:
{Object.ListOfArrays:{0} = first Item in Array, {1} = second Item in Array|; }This is the data in C# notation:
var Object = new { ListOfArrays = new List() { {1,2}, {1.4,4.12} } };And how I call Smart.Format:
Smart.Format( "{Object.ListOfArrays:{0} = first Item in Array, {1} = second Item in Array|; }", new{ Object=Object });My expected output is:
But instead of getting the items in the arrays back, SmartFormat outputs the first parameter on
{0}and nothing on{1}as there is no second parameter. And I perfectly understand why this happens as{0}refers to the first parameter on Smart.Format.But my question is: Is there any way to access the elements of the arrays per index? Or is this type of nested templates only possible with named selectors like in your examples?
I hope it is understandable what my problem is and maybe someone can help me with this issue.