1
0
mirror of https://github.com/oliverbooth/X10D synced 2024-11-10 05:15:43 +00:00

[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

View File

@ -72,38 +72,38 @@ public static class StringExtensions
/// <summary>
/// Converts this string from one encoding to another.
/// </summary>
/// <param name="str">The input string.</param>
/// <param name="from">The input encoding.</param>
/// <param name="to">The output encoding.</param>
/// <param name="value">The input string.</param>
/// <param name="sourceEncoding">The input encoding.</param>
/// <param name="destinationEncoding">The output encoding.</param>
/// <returns>
/// Returns a new <see cref="string" /> with its data converted to
/// <paramref name="to" />.
/// <paramref name="destinationEncoding" />.
/// </returns>
/// <exception cref="ArgumentNullException">
/// <paramref name="str" /> is <see langword="null" />
/// <paramref name="value" /> is <see langword="null" />
/// - or -
/// <paramref name="from" /> is <see langword="null" />
/// <paramref name="sourceEncoding" /> is <see langword="null" />
/// -or
/// <paramref name="to" /> is <see langword="null" />.
/// <paramref name="destinationEncoding" /> is <see langword="null" />.
/// </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>