[ci skip] Use meaningful parameter names (#14)

This commit is contained in:
Oliver Booth 2022-04-20 17:11:55 +01:00
parent 1c9bb0d82e
commit ea08d0fb9e
No known key found for this signature in database
GPG Key ID: 32A00B35503AF634
1 changed files with 15 additions and 15 deletions

View File

@ -72,38 +72,38 @@ public static class StringExtensions
/// <summary> /// <summary>
/// Converts this string from one encoding to another. /// Converts this string from one encoding to another.
/// </summary> /// </summary>
/// <param name="str">The input string.</param> /// <param name="value">The input string.</param>
/// <param name="from">The input encoding.</param> /// <param name="sourceEncoding">The input encoding.</param>
/// <param name="to">The output encoding.</param> /// <param name="destinationEncoding">The output encoding.</param>
/// <returns> /// <returns>
/// Returns a new <see cref="string" /> with its data converted to /// Returns a new <see cref="string" /> with its data converted to
/// <paramref name="to" />. /// <paramref name="destinationEncoding" />.
/// </returns> /// </returns>
/// <exception cref="ArgumentNullException"> /// <exception cref="ArgumentNullException">
/// <paramref name="str" /> is <see langword="null" /> /// <paramref name="value" /> is <see langword="null" />
/// - or - /// - or -
/// <paramref name="from" /> is <see langword="null" /> /// <paramref name="sourceEncoding" /> is <see langword="null" />
/// -or /// -or
/// <paramref name="to" /> is <see langword="null" />. /// <paramref name="destinationEncoding" /> is <see langword="null" />.
/// </exception> /// </exception>
public static string ChangeEncoding(this string str, Encoding from, Encoding to) public static string ChangeEncoding(this string value, Encoding sourceEncoding, Encoding destinationEncoding)
{ {
if (str is null) if (value is null)
{ {
throw new ArgumentNullException(nameof(str)); throw new ArgumentNullException(nameof(value));
} }
if (from is null) if (sourceEncoding is null)
{ {
throw new ArgumentNullException(nameof(from)); throw new ArgumentNullException(nameof(sourceEncoding));
} }
if (to is null) if (destinationEncoding is null)
{ {
throw new ArgumentNullException(nameof(to)); throw new ArgumentNullException(nameof(destinationEncoding));
} }
return str.GetBytes(from).ToString(to); return value.GetBytes(sourceEncoding).ToString(destinationEncoding);
} }
/// <summary> /// <summary>