I am trying to split the string based on ; and store it in array of string in MVC Razor view and I tried it as below:
@{
string[] replies = !string.IsNullOrEmpty(messages.MessageReply) ? messages.MessageReply.Split(';') : new string []{};
}
But whenever I write this it will treat last } of the string[] replies as its main closing bracket instead of the one below. How can I avoid this or how would I be declaring such sort of variables in razor view?
}bracket as closing bracket for@{.. Like if I usemessages.MessageReply.Split(new []{';'}, StringSplitOptions.RemoveEmptyEntries)it treats}insidesplitas closing bracket as it will be highlighted with yellow color...Split(new []{';'}works fine for me as well. I suspect there are other issues with your code (I can create a simple DotNetFiddle if you need the proof)