8000 Use string interpolation by atifaziz · Pull Request #863 · morelinq/MoreLINQ · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Use string interpolation #863

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions MoreLinq.Test/AggregateRightTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public void AggregateRight(SourceKind sourceKind)
{
var enumerable = Enumerable.Range(1, 5).Select(x => x.ToString()).ToSourceKind(sourceKind);

var result = enumerable.AggregateRight((a, b) => string.Format("({0}+{1})", a, b));
var result = enumerable.AggregateRight((a, b) => $"({a}+{b})");

Assert.That(result, Is.EqualTo("(1+(2+(3+(4+5))))"));
}
Expand Down Expand Up @@ -78,7 +78,7 @@ public void AggregateRightSeedFuncIsNotInvokedOnEmptySequence()
public void AggregateRightSeed()
{
var result = Enumerable.Range(1, 4)
.AggregateRight("5", (a, b) => string.Format("({0}+{1})", a, b));
.AggregateRight("5", (a, b) => $"({a}+{b})");

Assert.That(result, Is.EqualTo("(1+(2+(3+(4+5))))"));
}
Expand All @@ -90,14 +90,14 @@ public void AggregateRightSeed()
[TestCase(true)]
public void AggregateRightResultorWithEmptySequence(object defaultValue)
{
Assert.That(new int[0].AggregateRight(defaultValue, (a, b) => b, a => a == defaultValue), Is.EqualTo(true));
Assert.That(new int[0].AggregateRight(defaultValue, (_, b) => b, a => a == defaultValue), Is.EqualTo(true));
}

[Test]
public void AggregateRightResultor()
{
var result = Enumerable.Range(1, 4)
.AggregateRight("5", (a, b) => string.Format("({0}+{1})", a, b), a => a.Length);
.AggregateRight("5", (a, b) => $"({a}+{b})", a => a.Length);

Assert.That(result, Is.EqualTo("(1+(2+(3+(4+5))))".Length));
}
Expand Down
4 changes: 2 additions & 2 deletions MoreLinq.Test/ScanRightTest.cs
Original file line number Diff line number Diff line change
Expand 10000 Up @@ -64,7 +64,7 @@ public void ScanRight(SourceKind sourceKind)
var result = Enumerable.Range(1, 5)
.Select(x => x.ToString())
.ToSourceKind(sourceKind)
.ScanRight((a, b) => string.Format("({0}+{1})", a, b));
.ScanRight((a, b) => $"({a}+{b})");

var expectations = new[] { "(1+(2+(3+(4+5))))", "(2+(3+(4+5)))", "(3+(4+5))", "(4+5)", "5" };

Expand Down Expand Up @@ -101,7 +101,7 @@ public void ScanRightSeedFuncIsNotInvokedOnEmptySequence()
public void ScanRightSeed()
{
var result = Enumerable.Range(1, 4)
.ScanRight("5", (a, b) => string.Format("({0}+{1})", a, b));
.ScanRight("5", (a, b) => $"({a}+{b})");

var expectations = new[] { "(1+(2+(3+(4+5))))", "(2+(3+(4+5)))", "(3+(4+5))", "(4+5)", "5" };

Expand Down
6 changes: 3 additions & 3 deletions MoreLinq/AggregateRight.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ static partial class MoreEnumerable
/// <returns>The final accumulator value.</returns>
/// <example>
/// <code><![CDATA[
/// string result = Enumerable.Range(1, 5).Select(i => i.ToString()).AggregateRight((a, b) => string.Format("({0}/{1})", a, b));
/// string result = Enumerable.Range(1, 5).Select(i => i.ToString()).AggregateRight((a, b) => $"({a}/{b})");
/// ]]></code>
/// The <c>result</c> variable will contain <c>"(1/(2/(3/(4/5))))"</c>.
/// </example>
Expand Down Expand Up @@ -70,7 +70,7 @@ public static TSource AggregateRight<TSource>(this IEnumerable<TSource> source,
/// <example>
/// <code><![CDATA[
/// var numbers = Enumerable.Range(1, 5);
/// string result = numbers.AggregateRight("6", (a, b) => string.Format("({0}/{1})", a, b));
/// string result = numbers.AggregateRight("6", (a, b) => $"({a}/{b})");
/// ]]></code>
/// The <c>result</c> variable will contain <c>"(1/(2/(3/(4/(5/6)))))"</c>.
/// </example>
Expand Down Expand Up @@ -106,7 +106,7 @@ public static TAccumulate AggregateRight<TSource, TAccumulate>(this IEnumerable<
/// <example>
/// <code><![CDATA[
/// var numbers = Enumerable.Range(1, 5);
/// int result = numbers.AggregateRight("6", (a, b) => string.Format("({0}/{1})", a, b), str => str.Length);
/// int result = numbers.AggregateRight("6", (a, b) => $"({a}/{b})", str => str.Length);
/// ]]></code>
/// The <c>result</c> variable will contain <c>21</c>.
/// </example>
Expand Down
8 changes: 4 additions & 4 deletions MoreLinq/Extensions.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ public static partial class AggregateRightExtension
/// <returns>The final accumulator value.</returns>
/// <example>
/// <code><![CDATA[
/// string result = Enumerable.Range(1, 5).Select(i => i.ToString()).AggregateRight((a, b) => string.Format("({0}/{1})", a, b));
/// string result = Enumerable.Range(1, 5).Select(i => i.ToString()).AggregateRight((a, b) => $"({a}/{b})");
/// ]]></code>
/// The <c>result</c> variable will contain <c>"(1/(2/(3/(4/5))))"</c>.
/// </example>
Expand All @@ -386,7 +386,7 @@ public static TSource AggregateRight<TSource>(this IEnumerable<TSource> source,
/// <example>
/// <code><![CDATA[
/// var numbers = Enumerable.Range(1, 5);
/// string result = numbers.AggregateRight("6", (a, b) => string.Format("({0}/{1})", a, b));
/// string result = numbers.AggregateRight("6", (a, b) => $"({a}/{b})");
/// ]]></code>
/// The <c>result</c> variable will contain <c>"(1/(2/(3/(4/(5/6)))))"</c>.
/// </example>
Expand Down Expand Up @@ -415,7 +415,7 @@ public static TAccumulate AggregateRight<TSource, TAccumulate>(this IEnumerable<
/// <example>
/// <code><![CDATA[
/// var numbers = Enumerable.Range(1, 5);
/// int result = numbers.AggregateRight("6", (a, b) => string.Format("({0}/{1})", a, b), str => str.Length);
/// int result = numbers.AggregateRight("6", (a, b) => $"({a}/{b})", str => str.Length);
/// ]]></code>
/// The <c>result</c> variable will contain <c>21</c>.
/// </example>
Expand Down Expand Up @@ -5022,7 +5022,7 @@ public static IEnumerable<TSource> ScanRight<TSource>(this IEnumerable<TSource>
/// <returns>The scanned sequence.</returns>
/// <example>
/// <code><![CDATA[
/// var result = Enumerable.Range(1, 4).ScanRight("5", (a, b) => string.Format("({0}/{1})", a, b));
/// var result = Enumerable.Range(1, 4).ScanRight("5", (a, b) => $"({a}+{b})");
/// ]]></code>
/// The <c>result</c> variable will contain <c>[ "(1+(2+(3+(4+5))))", "(2+(3+(4+5)))", "(3+(4+5))", "(4+5)", "5" ]</c>.
/// </example>
Expand Down
2 changes: 1 addition & 1 deletion MoreLinq/ScanRight.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public static IEnumerable<TSource> ScanRight<TSource>(this IEnumerable<TSource>
/// <returns>The scanned sequence.</returns>
/// <example>
/// <code><![CDATA[
/// var result = Enumerable.Range(1, 4).ScanRight("5", (a, b) => string.Format("({0}/{1})", a, b));
/// var result = Enumerable.Range(1, 4).ScanRight("5", (a, b) => $"({a}+{b})");
/// ]]></code>
/// The <c>result</c> variable will contain <c>[ "(1+(2+(3+(4+5))))", "(2+(3+(4+5)))", "(3+(4+5))", "(4+5)", "5" ]</c>.
/// </example>
Expand Down
0