src/DiegoRangel.DotNet.Framework.CQRS.Infra.CrossCutting/Extensions/StringExtensions.cs
/// <summary>
/// Adds a char to end of given string if it does not ends with the char.
/// </summary>
Adds a char to end of given string if it does not ends with the char.
Adds a char to end of given string if it does not ends with the char .
public static string EnsureEndsWith(this string str, char c, StringComparison comparisonType)
        {
            if (str == null)
            {
                throw new ArgumentNullException(nameof(str));
            }
            if (str.EndsWith(c.ToString(CultureInfo.InvariantCulture), comparisonType))
            {
                return str;
            }
            return str + c;
        }
public static string EnsureEndsWith ( this string str , char c , StringComparison comparisonType ) { if ( str == null ) { throw new ArgumentNullException ( nameof ( str ) ) ; } if ( str . EndsWith ( c . ToString ( CultureInfo . InvariantCulture ) , comparisonType ) ) { return str ; } return str + c ; }
Adds a char to end of given string if it does not ends with the char.
Adds a char to end of given string if it does not ends with the char .
string
this
<not_specific>
c
char
<not_specific>
comparisonType
StringComparison
<not_specific>