Skip to content

Commit 4e6014f

Browse files
author
Oren (electricessence)
committed
Resharper inspection fixes.
1 parent d2e50fc commit 4e6014f

File tree

4 files changed

+10
-13
lines changed

4 files changed

+10
-13
lines changed

DynamicArithmetic.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public static T PowerOf<T>(this T a, uint power)
4747
if (power == 0)
4848
return (T)((dynamic)1);
4949

50-
T result = a;
50+
var result = a;
5151

5252
for (uint i = 1; i < power; i++)
5353
result *= (dynamic)a;

MathExtensions.cs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66
using System;
77
using System.Collections.Generic;
8-
using System.Linq;
98

109
namespace Open.Arithmetic
1110
{
@@ -34,7 +33,7 @@ public static int PowerOf(this int value, int power)
3433
if (value == -1)
3534
return power % 2 == 0 ? 1 : -1;
3635

37-
int v = 1;
36+
var v = 1;
3837
for (var i = 1; i < power; i++)
3938
v *= value;
4039
return v;
@@ -56,7 +55,7 @@ public static long PowerOf(this long value, int power)
5655
if (value == -1L)
5756
return power % 2 == 0 ? 1L : -1L;
5857

59-
long v = 1L;
58+
var v = 1L;
6059
for (var i = 1; i < power; i++)
6160
v *= value;
6261
return v;
@@ -72,9 +71,9 @@ public static int AsInteger(this bool[] source)
7271
if (source == null) throw new NullReferenceException();
7372
if (source.Length > 32) throw new ArgumentOutOfRangeException("Array cannot be greater than 32 bits.");
7473

75-
int result = 0;
74+
var result = 0;
7675

77-
for (int i = 0; i < source.Length; i++)
76+
for (var i = 0; i < source.Length; i++)
7877
if (source[i])
7978
result += 2.PowerOf(i);
8079

@@ -93,7 +92,7 @@ public static long AsLong(this bool[] source)
9392

9493
long result = 0;
9594

96-
for (int i = 0; i < source.Length; i++)
95+
for (var i = 0; i < source.Length; i++)
9796
if (source[i])
9897
result += 2L.PowerOf(i);
9998

@@ -198,5 +197,3 @@ public static double Difference(this IEnumerable<double> source)
198197

199198
}
200199
}
201-
202-

Open.Arithmetic.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ Part of the "Open" set of libraries.</Description>
3737
</ItemGroup>
3838

3939
<ItemGroup>
40-
<PackageReference Include="Open.Collections" Version="2.2.0" />
40+
<PackageReference Include="Open.Collections" Version="2.3.0" />
4141
</ItemGroup>
4242

4343
</Project>

Statistical.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public static double Variance(this IEnumerable<double> source)
1515

1616
double sum = 0;
1717
double sum2 = 0;
18-
int count = 0;
18+
var count = 0;
1919
foreach (var s in source)
2020
{
2121
if (double.IsNaN(s))
@@ -44,8 +44,8 @@ public static IEnumerable<double> Products(this IEnumerable<double> source, IEnu
4444

4545
while (true)
4646
{
47-
bool sv = sourceEnumerator.MoveNext();
48-
bool tv = targetEnumerator.MoveNext();
47+
var sv = sourceEnumerator.MoveNext();
48+
var tv = targetEnumerator.MoveNext();
4949

5050
if (sv != tv)
5151
throw new Exception("Products: source and target enumerations have different counts.");

0 commit comments

Comments
 (0)