csharp string capital first letter extension method

Code Example - csharp string capital first letter extension method

                
                        public static class StringExtensions
{
    public static string FirstCharToUpper(this string input) =>
        input switch
        {
            null => throw new ArgumentNullException(nameof(input)),
            "" => throw new ArgumentException(%%%~COMPRESS~PRE~0~%%%quot;{nameof(input)} cannot be empty", nameof(input)),
            _ => input.First().ToString().ToUpper() + input.Substring(1)
        };
}