Story: I have a list box that shows all the methods of the current application. I need to colorize the method parameters' data type to blue.
Solution: FIRST, I extract the content between the parenthesis. SECOND, I want to split them by COMMA
Problem:
If the arguments entail something like IDictionary<string, string>
which occurs multiple times, then the above solution faces problem!! Thus, I decided to FIRST grab all the content between the angle brackets and then Replace their comma with "#COMMA#"
and after performing the task using the above solution simply replace the "#COMMA#"
with ",". BUT, based on the solution found HERE, it is not possible to set any value to match.value
. Here is my code:
if (methodArgumentType.Contains("<") && methodArgumentType.Contains(">"))
{
var regex = new Regex("(?<=<).*?(?=>)");
foreach (Match match in regex.Matches(methodArgumentType))
{
match.Value = match.Value.Replace(",", "#COMMA#");
}
}
Any suggestion highly appreciated.