If I have string and I want to replace last character from that string with star for example.
I tried this
var myString = "ABCDEFGH";
myString.ReplaceCharacter(mystring.Length - 1, 1, "*");
public static string ReplaceCharacter(this string str, int start, int length, string replaceWith_expression)
{
return str.Remove(start, length).Insert(start, replaceWith_expression);
}
I tried to use this extension method but this doesn't work. Why this doesn't work?