Skip to content

Commit 45e6746

Browse files
committed
Cleanup
1 parent 633a201 commit 45e6746

File tree

4 files changed

+15
-25
lines changed

4 files changed

+15
-25
lines changed

Main/src/Collections/QueryableExtensions.Ranges.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ public static IQueryable<T> Intersect<T, TValue>(
185185

186186
var predicate = left != null && right != null
187187
? And(left, right)
188-
: (left ?? right ?? FalseExpression());
188+
: left ?? right ?? FalseExpression();
189189

190190
// DbEnd >= @from AND DbStart <= @to
191191
return source.Where(Lambda<Func<T, bool>>(predicate, eParam));

Main/src/ExceptionExtensions.cs

Lines changed: 13 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -43,27 +43,18 @@ public static StringBuilder ToDiagnosticString(this Exception exception, [NotNul
4343
if (ex.StackTrace.NotNullNorEmpty())
4444
stringBuilder.AppendLine(ex.StackTrace);
4545

46-
if (ex is FileNotFoundException notFoundException)
47-
{
48-
var fex = notFoundException;
49-
50-
stringBuilder.AppendLine($"File Name: {fex.FileName}");
51-
52-
if (fex.FusionLog.IsNullOrEmpty())
53-
{
54-
stringBuilder.AppendLine("Fusion log is empty or disabled.");
55-
}
56-
else
57-
{
58-
stringBuilder.Append(fex.FusionLog);
59-
}
60-
}
61-
else
62-
{
63-
var aex = ex as AggregateException;
64-
65-
if (aex?.InnerExceptions != null)
66-
{
46+
switch (ex) {
47+
case FileNotFoundException notFoundException:
48+
var fex = notFoundException;
49+
50+
stringBuilder.AppendLine($"File Name: {fex.FileName}");
51+
52+
if (fex.FusionLog.IsNullOrEmpty())
53+
stringBuilder.AppendLine("Fusion log is empty or disabled.");
54+
else
55+
stringBuilder.Append(fex.FusionLog);
56+
break;
57+
case AggregateException aex when aex.InnerExceptions != null:
6758
var foundInnerException = false;
6859

6960
foreach (var e in aex.InnerExceptions)
@@ -74,7 +65,7 @@ public static StringBuilder ToDiagnosticString(this Exception exception, [NotNul
7465

7566
if (foundInnerException)
7667
ex = ex.InnerException;
77-
}
68+
break;
7869
}
7970
}
8071

Main/src/Reflection/MemberAccessor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ Expression MakeGetter(Expression ex, int i)
102102
// Build setter.
103103
//
104104
{
105-
HasSetter = !infos.Any(info => info.member is PropertyInfo && ((PropertyInfo)info.member).GetSetMethod(true) == null);
105+
HasSetter = !infos.Any(info => info.member is PropertyInfo propertyInfo && propertyInfo.GetSetMethod(true) == null);
106106

107107
var valueParam = Expression.Parameter(Type, "value");
108108

Main/src/Reflection/ReflectionExtensions.CreateInstance.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
using System;
2-
using System.Collections.Generic;
32
using System.Linq;
43
using System.Reflection;
54

0 commit comments

Comments
 (0)