Skip to content

Commit 3b0c218

Browse files
committed
Ran full code cleanup by ReSharper 8 default settings. Mostly XML doc formatting, some re-positioning of class members.
1 parent 2b69966 commit 3b0c218

File tree

5 files changed

+51
-50
lines changed

5 files changed

+51
-50
lines changed

Src/UnitsNet/Mass.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ private Mass(double kilograms)
4343
}
4444

4545
/// <summary>
46-
/// The short ton is a unit of mass equal to 2,000 pounds (907.18474 kg), that is most commonly used in the United States – known there simply as the ton.
46+
/// The short ton is a unit of mass equal to 2,000 pounds (907.18474 kg), that is most commonly used in the United States – known there simply as the ton.
4747
/// </summary>
4848
/// <remarks>http://en.wikipedia.org/wiki/Short_ton</remarks>
4949
public double ShortTons
@@ -52,7 +52,7 @@ public double ShortTons
5252
}
5353

5454
/// <summary>
55-
/// Long ton (weight ton or Imperial ton) is a unit of mass equal to 2,240 pounds (1,016 kg) and is the name for the unit called the "ton" in the avoirdupois or Imperial system of measurements that was used in the United Kingdom and several other Commonwealth countries before metrication.
55+
/// Long ton (weight ton or Imperial ton) is a unit of mass equal to 2,240 pounds (1,016 kg) and is the name for the unit called the "ton" in the avoirdupois or Imperial system of measurements that was used in the United Kingdom and several other Commonwealth countries before metrication.
5656
/// </summary>
5757
/// <remarks>http://en.wikipedia.org/wiki/Long_ton</remarks>
5858
public double LongTons
@@ -185,7 +185,7 @@ public static Mass FromGravitationalForce(Force f)
185185
}
186186

187187
/// <summary>
188-
/// Long ton (weight ton or Imperial ton) is a unit of mass equal to 2,240 pounds (1,016 kg) and is the name for the unit called the "ton" in the avoirdupois or Imperial system of measurements that was used in the United Kingdom and several other Commonwealth countries before metrication.
188+
/// Long ton (weight ton or Imperial ton) is a unit of mass equal to 2,240 pounds (1,016 kg) and is the name for the unit called the "ton" in the avoirdupois or Imperial system of measurements that was used in the United Kingdom and several other Commonwealth countries before metrication.
189189
/// </summary>
190190
/// <remarks>http://en.wikipedia.org/wiki/Long_ton</remarks>
191191
public static Mass FromLongTons(double value)
@@ -194,7 +194,7 @@ public static Mass FromLongTons(double value)
194194
}
195195

196196
/// <summary>
197-
/// The short ton is a unit of mass equal to 2,000 pounds (907.18474 kg), that is most commonly used in the United States – known there simply as the ton.
197+
/// The short ton is a unit of mass equal to 2,000 pounds (907.18474 kg), that is most commonly used in the United States – known there simply as the ton.
198198
/// </summary>
199199
/// <remarks>http://en.wikipedia.org/wiki/Short_ton</remarks>
200200
public static Mass FromShortTons(double value)

Src/UnitsNet/Pressure.cs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,18 @@ public static Pressure FromPsi(double psi)
259259

260260
#region Equality / IComparable
261261

262+
public int CompareTo(object obj)
263+
{
264+
if (obj == null) throw new ArgumentNullException("obj");
265+
if (!(obj is Pressure)) throw new ArgumentException("Expected type Pressure.", "obj");
266+
return CompareTo((Pressure) obj);
267+
}
268+
269+
public int CompareTo(Pressure other)
270+
{
271+
return Pascals.CompareTo(other.Pascals);
272+
}
273+
262274
public override bool Equals(object obj)
263275
{
264276
if (ReferenceEquals(null, obj)) return false;
@@ -275,18 +287,6 @@ public override int GetHashCode()
275287
return Pascals.GetHashCode();
276288
}
277289

278-
public int CompareTo(object obj)
279-
{
280-
if (obj == null) throw new ArgumentNullException("obj");
281-
if (!(obj is Pressure)) throw new ArgumentException("Expected type Pressure.", "obj");
282-
return CompareTo((Pressure) obj);
283-
}
284-
285-
public int CompareTo(Pressure other)
286-
{
287-
return Pascals.CompareTo(other.Pascals);
288-
}
289-
290290
#endregion
291291

292292
public override string ToString()

Src/UnitsNet/Unit.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,13 @@ public enum Unit
5656

5757
// Mass (imperial)
5858
/// <summary>
59-
/// The short ton is a unit of mass equal to 2,000 pounds (907.18474 kg), that is most commonly used in the United States – known there simply as the ton.
59+
/// The short ton is a unit of mass equal to 2,000 pounds (907.18474 kg), that is most commonly used in the United States – known there simply as the ton.
6060
/// </summary>
6161
/// <remarks>http://en.wikipedia.org/wiki/Short_ton</remarks>
6262
ShortTon,
63+
6364
/// <summary>
64-
/// Long ton (weight ton or Imperial ton) is a unit of mass equal to 2,240 pounds (1,016 kg) and is the name for the unit called the "ton" in the avoirdupois or Imperial system of measurements that was used in the United Kingdom and several other Commonwealth countries before metrication.
65+
/// Long ton (weight ton or Imperial ton) is a unit of mass equal to 2,240 pounds (1,016 kg) and is the name for the unit called the "ton" in the avoirdupois or Imperial system of measurements that was used in the United Kingdom and several other Commonwealth countries before metrication.
6566
/// </summary>
6667
/// <remarks>http://en.wikipedia.org/wiki/Long_ton</remarks>
6768
LongTon,

Src/UnitsNet/UnitValue.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,12 @@ public UnitValue(double value, Unit unit)
3939

4040
public bool TryConvert(Unit toUnit, out double newValue)
4141
{
42-
return UnitConverter.TryConvert(this.Value, this.Unit, toUnit, out newValue);
42+
return UnitConverter.TryConvert(Value, Unit, toUnit, out newValue);
43+
}
44+
45+
public override string ToString()
46+
{
47+
return Value + " " + UnitSystem.Create(CultureInfo.CurrentCulture).GetDefaultAbbreviation(Unit);
4348
}
4449

4550
#region Equality
@@ -92,10 +97,5 @@ public override int GetHashCode()
9297
}
9398

9499
#endregion
95-
96-
public override string ToString()
97-
{
98-
return Value + " " + UnitSystem.Create(CultureInfo.CurrentCulture).GetDefaultAbbreviation(Unit);
99-
}
100100
}
101101
}

Src/UnitsNet/Volume.cs

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,12 @@ namespace UnitsNet
2929
public struct Volume : IComparable, IComparable<Volume>
3030
{
3131
private const double CubicKilometersToCubicMetersRatio = 1E9;
32-
private const double CubicDecimetersToCubicMetersRatio = 1E-3;
32+
private const double CubicDecimetersToCubicMetersRatio = 1E-3;
3333
private const double CubicCentimetersToCubicMetersRatio = 1E-6;
34-
private const double CubicMillimetersToCubicMetersRatio = 1E-9;
35-
private const double HectolitersToCubicMetersRatio = 1E-1;
36-
private const double LitersToCubicMetersRatio = 1E-3;
37-
private const double DecilitersToCubicMetersRatio = 1E-4;
34+
private const double CubicMillimetersToCubicMetersRatio = 1E-9;
35+
private const double HectolitersToCubicMetersRatio = 1E-1;
36+
private const double LitersToCubicMetersRatio = 1E-3;
37+
private const double DecilitersToCubicMetersRatio = 1E-4;
3838
private const double CentilitersToCubicMetersRatio = 1E-5;
3939
private const double MillilitersToCubicMetersRatio = 1E-6;
4040

@@ -53,47 +53,47 @@ private Volume(double cubicMeters)
5353

5454
public double CubicKilometers
5555
{
56-
get { return CubicMeters / CubicKilometersToCubicMetersRatio; }
56+
get { return CubicMeters/CubicKilometersToCubicMetersRatio; }
5757
}
5858

5959
public double CubicDecimeters
6060
{
61-
get { return CubicMeters / CubicDecimetersToCubicMetersRatio; }
61+
get { return CubicMeters/CubicDecimetersToCubicMetersRatio; }
6262
}
6363

6464
public double CubicCentimeters
6565
{
66-
get { return CubicMeters / CubicCentimetersToCubicMetersRatio; }
66+
get { return CubicMeters/CubicCentimetersToCubicMetersRatio; }
6767
}
6868

6969
public double CubicMillimeters
7070
{
71-
get { return CubicMeters / CubicMillimetersToCubicMetersRatio; }
71+
get { return CubicMeters/CubicMillimetersToCubicMetersRatio; }
7272
}
7373

7474
public double Hectoliters
7575
{
76-
get { return CubicMeters / HectolitersToCubicMetersRatio; }
76+
get { return CubicMeters/HectolitersToCubicMetersRatio; }
7777
}
7878

7979
public double Liters
8080
{
81-
get { return CubicMeters / LitersToCubicMetersRatio; }
81+
get { return CubicMeters/LitersToCubicMetersRatio; }
8282
}
8383

8484
public double Deciliters
8585
{
86-
get { return CubicMeters / DecilitersToCubicMetersRatio; }
86+
get { return CubicMeters/DecilitersToCubicMetersRatio; }
8787
}
8888

8989
public double Centiliters
9090
{
91-
get { return CubicMeters / CentilitersToCubicMetersRatio; }
91+
get { return CubicMeters/CentilitersToCubicMetersRatio; }
9292
}
9393

9494
public double Milliliters
9595
{
96-
get { return CubicMeters / MillilitersToCubicMetersRatio; }
96+
get { return CubicMeters/MillilitersToCubicMetersRatio; }
9797
}
9898

9999
#endregion
@@ -123,7 +123,7 @@ public static Volume Zero
123123

124124
public static Volume FromCubicKilometers(double cubicKilometers)
125125
{
126-
return new Volume(cubicKilometers * CubicKilometersToCubicMetersRatio);
126+
return new Volume(cubicKilometers*CubicKilometersToCubicMetersRatio);
127127
}
128128

129129
public static Volume FromCubicMeters(double cubicMeters)
@@ -133,42 +133,42 @@ public static Volume FromCubicMeters(double cubicMeters)
133133

134134
public static Volume FromCubicDecimeters(double cubicDecimeters)
135135
{
136-
return new Volume(cubicDecimeters * CubicDecimetersToCubicMetersRatio);
136+
return new Volume(cubicDecimeters*CubicDecimetersToCubicMetersRatio);
137137
}
138138

139139
public static Volume FromCubicCentimeters(double cubicCentimeters)
140140
{
141-
return new Volume(cubicCentimeters * CubicCentimetersToCubicMetersRatio);
141+
return new Volume(cubicCentimeters*CubicCentimetersToCubicMetersRatio);
142142
}
143143

144144
public static Volume FromCubicMillimeters(double cubicMillimeters)
145145
{
146-
return new Volume(cubicMillimeters * CubicMillimetersToCubicMetersRatio);
146+
return new Volume(cubicMillimeters*CubicMillimetersToCubicMetersRatio);
147147
}
148148

149149
public static Volume FromHectoliters(double hectoliters)
150150
{
151-
return new Volume(hectoliters * HectolitersToCubicMetersRatio);
151+
return new Volume(hectoliters*HectolitersToCubicMetersRatio);
152152
}
153153

154154
public static Volume FromLiters(double liters)
155155
{
156-
return new Volume(liters * LitersToCubicMetersRatio);
156+
return new Volume(liters*LitersToCubicMetersRatio);
157157
}
158158

159159
public static Volume FromDeciliters(double deciliters)
160160
{
161-
return new Volume(deciliters * DecilitersToCubicMetersRatio);
161+
return new Volume(deciliters*DecilitersToCubicMetersRatio);
162162
}
163163

164164
public static Volume FromCentiliters(double centiliters)
165165
{
166-
return new Volume(centiliters * CentilitersToCubicMetersRatio);
166+
return new Volume(centiliters*CentilitersToCubicMetersRatio);
167167
}
168168

169169
public static Volume FromMilliliters(double milliliters)
170170
{
171-
return new Volume(milliliters * MillilitersToCubicMetersRatio);
171+
return new Volume(milliliters*MillilitersToCubicMetersRatio);
172172
}
173173

174174
#endregion
@@ -232,7 +232,7 @@ public int CompareTo(object obj)
232232
{
233233
if (obj == null) throw new ArgumentNullException("obj");
234234
if (!(obj is Volume)) throw new ArgumentException("Expected type Volume.", "obj");
235-
return CompareTo((Volume)obj);
235+
return CompareTo((Volume) obj);
236236
}
237237

238238
public int CompareTo(Volume other)
@@ -247,7 +247,7 @@ public override bool Equals(object obj)
247247
return false;
248248
}
249249

250-
return CubicMeters.CompareTo(((Volume)obj).CubicMeters) == 0;
250+
return CubicMeters.CompareTo(((Volume) obj).CubicMeters) == 0;
251251
}
252252

253253
public override int GetHashCode()
@@ -262,4 +262,4 @@ public override string ToString()
262262
return CubicMeters + " m3";
263263
}
264264
}
265-
}
265+
}

0 commit comments

Comments
 (0)