Skip to content

Commit a217230

Browse files
use modern language features
1 parent 2631a0d commit a217230

16 files changed

+195
-141
lines changed

Sources/LambdaConverters.Wpf/Converter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ namespace LambdaConverters
77
{
88
internal abstract class Converter
99
{
10-
internal Converter(
10+
protected Converter(
1111
ConverterErrorStrategy errorStrategy,
1212
object defaultInputTypeValue,
1313
object defaultOutputTypeValue,

Sources/LambdaConverters.Wpf/LambdaConverters.Wpf.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
<PropertyGroup>
44
<TargetFrameworks>netcoreapp3.0;net46;net45</TargetFrameworks>
55
<UseWPF>true</UseWPF>
6+
<RootNamespace>LambdaConverters</RootNamespace>
67
<GenerateDocumentationFile>true</GenerateDocumentationFile>
78
<PackageId>LambdaConverters</PackageId>
89
<Version>3.0.0</Version>

Sources/LambdaConverters.Wpf/MultiValueConverterArgs[T,P].IEquatable[MultiValueConverterArgs[T,P]].cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public override int GetHashCode()
3232
EqualityComparer<P>.Default.GetHashCode(Parameter) ^ (Culture?.GetHashCode() ?? 0);
3333

3434
/// <inheritdoc />
35-
public override bool Equals(object obj) => obj is MultiValueConverterArgs<T, P> && Equals((MultiValueConverterArgs<T, P>)obj);
35+
public override bool Equals(object obj) => obj is MultiValueConverterArgs<T, P> args && Equals(args);
3636

3737
/// <inheritdoc />
3838
public bool Equals(MultiValueConverterArgs<T, P> other) => this == other;

Sources/LambdaConverters.Wpf/MultiValueConverterArgs[T].IEquatable[MultiValueConverterArgs[T]].cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public override int GetHashCode()
3030
=> (values?.Aggregate(0, (a, item) => a ^ EqualityComparer<T>.Default.GetHashCode(item)) ?? 0) ^ (Culture?.GetHashCode() ?? 0);
3131

3232
/// <inheritdoc />
33-
public override bool Equals(object obj) => obj is MultiValueConverterArgs<T> && Equals((MultiValueConverterArgs<T>)obj);
33+
public override bool Equals(object obj) => obj is MultiValueConverterArgs<T> args && Equals(args);
3434

3535
/// <inheritdoc />
3636
public bool Equals(MultiValueConverterArgs<T> other) => this == other;

Sources/LambdaConverters.Wpf/TemplateSelectorArgs[T].IEquatable[TemplateSelectorArgs[T]].cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ partial struct TemplateSelectorArgs<T> : IEquatable<TemplateSelectorArgs<T>>
2525
public override int GetHashCode() => EqualityComparer<T>.Default.GetHashCode(Item) ^ (Container?.GetHashCode() ?? 0);
2626

2727
/// <inheritdoc />
28-
public override bool Equals(object obj) => obj is TemplateSelectorArgs<T> && Equals((TemplateSelectorArgs<T>)obj);
28+
public override bool Equals(object obj) => obj is TemplateSelectorArgs<T> args && Equals(args);
2929

3030
/// <inheritdoc />
3131
public bool Equals(TemplateSelectorArgs<T> other) => this == other;

Sources/LambdaConverters.Wpf/ValidationRuleArgs[T].IEquatable[ValidationRuleArgs[T]].cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ partial struct ValidationRuleArgs<T> : IEquatable<ValidationRuleArgs<T>>
2525
public override int GetHashCode() => EqualityComparer<T>.Default.GetHashCode(Value) ^ (Culture?.GetHashCode() ?? 0);
2626

2727
/// <inheritdoc />
28-
public override bool Equals(object obj) => obj is ValidationRuleArgs<T> && Equals((ValidationRuleArgs<T>)obj);
28+
public override bool Equals(object obj) => obj is ValidationRuleArgs<T> args && Equals(args);
2929

3030
/// <inheritdoc />
3131
public bool Equals(ValidationRuleArgs<T> other) => this == other;

Sources/LambdaConverters.Wpf/ValueConverterArgs[T,P].IEquatable[ValueConverterArgs[T,P]].cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public override int GetHashCode()
2828
=> EqualityComparer<T>.Default.GetHashCode(Value) ^ EqualityComparer<P>.Default.GetHashCode(Parameter) ^ (Culture?.GetHashCode() ?? 0);
2929

3030
/// <inheritdoc />
31-
public override bool Equals(object obj) => obj is ValueConverterArgs<T, P> && Equals((ValueConverterArgs<T, P>)obj);
31+
public override bool Equals(object obj) => obj is ValueConverterArgs<T, P> args && Equals(args);
3232

3333
/// <inheritdoc />
3434
public bool Equals(ValueConverterArgs<T, P> other) => this == other;

Sources/LambdaConverters.Wpf/ValueConverterArgs[T].IEquatable[ValueConverterArgs[T]].cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ partial struct ValueConverterArgs<T> : IEquatable<ValueConverterArgs<T>>
2525
public override int GetHashCode() => EqualityComparer<T>.Default.GetHashCode(Value) ^ (Culture?.GetHashCode() ?? 0);
2626

2727
/// <inheritdoc />
28-
public override bool Equals(object obj) => obj is ValueConverterArgs<T> && Equals((ValueConverterArgs<T>)obj);
28+
public override bool Equals(object obj) => obj is ValueConverterArgs<T> args && Equals(args);
2929

3030
/// <inheritdoc />
3131
public bool Equals(ValueConverterArgs<T> other) => this == other;

Sources/Tests.LambdaConverters.Wpf/MultiValueConverterTests.cs

Lines changed: 154 additions & 122 deletions
Large diffs are not rendered by default.

Sources/Tests.LambdaConverters.Wpf/TemplateSelectorTests.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ public void NoFunctions()
3232
[TestMethod]
3333
public void WithSelectFunction()
3434
{
35-
3635
// with an input value of an unexpected type (use default error strategy)
3736
Assert.IsNull(TemplateSelector.Create<int>(e => new DataTemplate()).SelectTemplate(true, null));
3837
Assert.IsNull(TemplateSelector.Create<int>(e => new DataTemplate()).SelectTemplate(null, null));
@@ -68,9 +67,9 @@ public void CompareTemplateSelectorArgs()
6867
}).SelectTemplate(1, null));
6968

7069
StructAssert.AreEqual(arg, (x, y) => x == y, (x, y) => x != y);
71-
StructAssert.AreNotEqual(arg, default(TemplateSelectorArgs<int>), (x, y) => x == y, (x, y) => x != y);
70+
StructAssert.AreNotEqual(arg, default, (x, y) => x == y, (x, y) => x != y);
7271

73-
new HashSet<TemplateSelectorArgs<int>> { default(TemplateSelectorArgs<int>), arg, arg };
72+
new HashSet<TemplateSelectorArgs<int>> { default, arg, arg };
7473
}
7574
}
7675
}

0 commit comments

Comments
 (0)