Reputation: 160
labels: [@foreach (var item in new string[]{"ONE","TWO","THREE","FOUR","FIVE","SIX","SEVEN","EIGHT","NINE","TEN"})
{
@item
}]
With this code I am able to get result as ONETWOTHREEFOURFIVESIXSEVENEIGHTNINETEN
, The expected result i want to get inside label is "ONE","TWO","THREE","FOUR","FIVE","SIX","SEVEN","EIGHT","NINE","TEN"
Upvotes: 0
Views: 147
Reputation: 830
You can use the String.Format
, change your code as follows:
labels: [@foreach (var item in new string[]{"ONE","TWO","THREE","FOUR","FIVE","SIX","SEVEN","EIGHT","NINE","TEN"})
{
@String.Format("\"{0}\"{1}", item,!item.Equals("TEN")?",":"")
}
Upvotes: 1