C# – Remove first or last character from a string

Use string.Remove() to remove character(s) from a string based on their index, such as the first or last character. This method has two parameters: string.Remove() returns a new string with the characters removed. I’ll show examples below. Remove the first character from a string To remove the first character, use string.Remove(startIndex: 0, count: 1), like … Read more

CA1806: Do not ignore method results

The CA1806 warning is triggered whenever you call a method and ignore the return value. I’ll show examples of a few of the scenarios where you might run into this. CA1806 – When you call a string method and don’t use the new string Strings are immutable. Once you create a string, you can’t change … Read more