Skip to content

Commit 794777d

Browse files
committed
Merge remote-tracking branch 'tmil/RemoveObsoleteMethods' into v4
2 parents 84e93db + c32c9d2 commit 794777d

File tree

401 files changed

+423
-28436
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

401 files changed

+423
-28436
lines changed

Common/GeneratedCode/Quantities/Acceleration.Common.g.cs

Lines changed: 2 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -82,21 +82,11 @@ static Acceleration()
8282
BaseDimensions = new BaseDimensions(1, 0, -2, 0, 0, 0, 0);
8383
}
8484

85-
/// <summary>
86-
/// Creates the quantity with the given value in the base unit MeterPerSecondSquared.
87-
/// </summary>
88-
[Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")]
89-
public Acceleration(double meterspersecondsquared)
90-
{
91-
_value = Convert.ToDouble(meterspersecondsquared);
92-
_unit = BaseUnit;
93-
}
94-
9585
/// <summary>
9686
/// Creates the quantity with the given numeric value and unit.
9787
/// </summary>
9888
/// <param name="numericValue">Numeric value.</param>
99-
/// <param name="unit">Unit representation.</param>
89+
/// <param name="unit">The unit representation to contruct this quantity with.</param>
10090
/// <remarks>Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component.</remarks>
10191
#if WINDOWS_UWP
10292
private
@@ -109,33 +99,6 @@ public Acceleration(double meterspersecondsquared)
10999
_unit = unit;
110100
}
111101

112-
// Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods
113-
/// <summary>
114-
/// Creates the quantity with the given value assuming the base unit MeterPerSecondSquared.
115-
/// </summary>
116-
/// <param name="meterspersecondsquared">Value assuming base unit MeterPerSecondSquared.</param>
117-
#if WINDOWS_UWP
118-
private
119-
#else
120-
[Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")]
121-
public
122-
#endif
123-
Acceleration(long meterspersecondsquared) : this(Convert.ToDouble(meterspersecondsquared), BaseUnit) { }
124-
125-
// Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods
126-
// Windows Runtime Component does not support decimal type
127-
/// <summary>
128-
/// Creates the quantity with the given value assuming the base unit MeterPerSecondSquared.
129-
/// </summary>
130-
/// <param name="meterspersecondsquared">Value assuming base unit MeterPerSecondSquared.</param>
131-
#if WINDOWS_UWP
132-
private
133-
#else
134-
[Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")]
135-
public
136-
#endif
137-
Acceleration(decimal meterspersecondsquared) : this(Convert.ToDouble(meterspersecondsquared), BaseUnit) { }
138-
139102
#region Properties
140103

141104
/// <summary>
@@ -144,7 +107,7 @@ public Acceleration(double meterspersecondsquared)
144107
public static QuantityType QuantityType => QuantityType.Acceleration;
145108

146109
/// <summary>
147-
/// The base unit representation of this quantity for the numeric value stored internally. All conversions go via this value.
110+
/// The base unit of Acceleration, which is MeterPerSecondSquared. All conversions go via this value.
148111
/// </summary>
149112
public static AccelerationUnit BaseUnit => AccelerationUnit.MeterPerSecondSquared;
150113

@@ -469,16 +432,6 @@ int CompareTo(Acceleration other)
469432
return _value.CompareTo(other.AsBaseNumericType(this.Unit));
470433
}
471434

472-
[Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")]
473-
public override bool Equals(object obj)
474-
{
475-
if(obj is null || !(obj is Acceleration))
476-
return false;
477-
478-
var objQuantity = (Acceleration)obj;
479-
return _value.Equals(objQuantity.AsBaseNumericType(this.Unit));
480-
}
481-
482435
/// <summary>
483436
/// <para>
484437
/// Compare equality to another Acceleration within the given absolute or relative tolerance.
@@ -530,20 +483,6 @@ public bool Equals(Acceleration other, double tolerance, ComparisonType comparis
530483
return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType);
531484
}
532485

533-
/// <summary>
534-
/// Compare equality to another Acceleration by specifying a max allowed difference.
535-
/// Note that it is advised against specifying zero difference, due to the nature
536-
/// of floating point operations and using System.Double internally.
537-
/// </summary>
538-
/// <param name="other">Other quantity to compare to.</param>
539-
/// <param name="maxError">Max error allowed.</param>
540-
/// <returns>True if the difference between the two values is not greater than the specified max.</returns>
541-
[Obsolete("Please use the Equals(Acceleration, double, ComparisonType) overload. This method will be removed in a future version.")]
542-
public bool Equals(Acceleration other, Acceleration maxError)
543-
{
544-
return Math.Abs(_value - other.AsBaseNumericType(this.Unit)) <= maxError.AsBaseNumericType(this.Unit);
545-
}
546-
547486
/// <summary>
548487
/// Returns the hash code for this instance.
549488
/// </summary>
@@ -694,12 +633,6 @@ public static AccelerationUnit ParseUnit(string str)
694633

695634
#endregion
696635

697-
/// <summary>
698-
/// Set the default unit used by ToString(). Default is MeterPerSecondSquared
699-
/// </summary>
700-
[Obsolete("This is no longer used since we will instead use the quantity's Unit value as default.")]
701-
public static AccelerationUnit ToStringDefaultUnit { get; set; } = AccelerationUnit.MeterPerSecondSquared;
702-
703636
/// <summary>
704637
/// Get default string representation of value and unit.
705638
/// </summary>

Common/GeneratedCode/Quantities/AmountOfSubstance.Common.g.cs

Lines changed: 2 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -82,21 +82,11 @@ static AmountOfSubstance()
8282
BaseDimensions = new BaseDimensions(0, 0, 0, 0, 0, 1, 0);
8383
}
8484

85-
/// <summary>
86-
/// Creates the quantity with the given value in the base unit Mole.
87-
/// </summary>
88-
[Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")]
89-
public AmountOfSubstance(double moles)
90-
{
91-
_value = Convert.ToDouble(moles);
92-
_unit = BaseUnit;
93-
}
94-
9585
/// <summary>
9686
/// Creates the quantity with the given numeric value and unit.
9787
/// </summary>
9888
/// <param name="numericValue">Numeric value.</param>
99-
/// <param name="unit">Unit representation.</param>
89+
/// <param name="unit">The unit representation to contruct this quantity with.</param>
10090
/// <remarks>Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component.</remarks>
10191
#if WINDOWS_UWP
10292
private
@@ -109,33 +99,6 @@ public AmountOfSubstance(double moles)
10999
_unit = unit;
110100
}
111101

112-
// Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods
113-
/// <summary>
114-
/// Creates the quantity with the given value assuming the base unit Mole.
115-
/// </summary>
116-
/// <param name="moles">Value assuming base unit Mole.</param>
117-
#if WINDOWS_UWP
118-
private
119-
#else
120-
[Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")]
121-
public
122-
#endif
123-
AmountOfSubstance(long moles) : this(Convert.ToDouble(moles), BaseUnit) { }
124-
125-
// Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods
126-
// Windows Runtime Component does not support decimal type
127-
/// <summary>
128-
/// Creates the quantity with the given value assuming the base unit Mole.
129-
/// </summary>
130-
/// <param name="moles">Value assuming base unit Mole.</param>
131-
#if WINDOWS_UWP
132-
private
133-
#else
134-
[Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")]
135-
public
136-
#endif
137-
AmountOfSubstance(decimal moles) : this(Convert.ToDouble(moles), BaseUnit) { }
138-
139102
#region Properties
140103

141104
/// <summary>
@@ -144,7 +107,7 @@ public AmountOfSubstance(double moles)
144107
public static QuantityType QuantityType => QuantityType.AmountOfSubstance;
145108

146109
/// <summary>
147-
/// The base unit representation of this quantity for the numeric value stored internally. All conversions go via this value.
110+
/// The base unit of AmountOfSubstance, which is Mole. All conversions go via this value.
148111
/// </summary>
149112
public static AmountOfSubstanceUnit BaseUnit => AmountOfSubstanceUnit.Mole;
150113

@@ -488,16 +451,6 @@ int CompareTo(AmountOfSubstance other)
488451
return _value.CompareTo(other.AsBaseNumericType(this.Unit));
489452
}
490453

491-
[Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")]
492-
public override bool Equals(object obj)
493-
{
494-
if(obj is null || !(obj is AmountOfSubstance))
495-
return false;
496-
497-
var objQuantity = (AmountOfSubstance)obj;
498-
return _value.Equals(objQuantity.AsBaseNumericType(this.Unit));
499-
}
500-
501454
/// <summary>
502455
/// <para>
503456
/// Compare equality to another AmountOfSubstance within the given absolute or relative tolerance.
@@ -549,20 +502,6 @@ public bool Equals(AmountOfSubstance other, double tolerance, ComparisonType com
549502
return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType);
550503
}
551504

552-
/// <summary>
553-
/// Compare equality to another AmountOfSubstance by specifying a max allowed difference.
554-
/// Note that it is advised against specifying zero difference, due to the nature
555-
/// of floating point operations and using System.Double internally.
556-
/// </summary>
557-
/// <param name="other">Other quantity to compare to.</param>
558-
/// <param name="maxError">Max error allowed.</param>
559-
/// <returns>True if the difference between the two values is not greater than the specified max.</returns>
560-
[Obsolete("Please use the Equals(AmountOfSubstance, double, ComparisonType) overload. This method will be removed in a future version.")]
561-
public bool Equals(AmountOfSubstance other, AmountOfSubstance maxError)
562-
{
563-
return Math.Abs(_value - other.AsBaseNumericType(this.Unit)) <= maxError.AsBaseNumericType(this.Unit);
564-
}
565-
566505
/// <summary>
567506
/// Returns the hash code for this instance.
568507
/// </summary>
@@ -715,12 +654,6 @@ public static AmountOfSubstanceUnit ParseUnit(string str)
715654

716655
#endregion
717656

718-
/// <summary>
719-
/// Set the default unit used by ToString(). Default is Mole
720-
/// </summary>
721-
[Obsolete("This is no longer used since we will instead use the quantity's Unit value as default.")]
722-
public static AmountOfSubstanceUnit ToStringDefaultUnit { get; set; } = AmountOfSubstanceUnit.Mole;
723-
724657
/// <summary>
725658
/// Get default string representation of value and unit.
726659
/// </summary>

Common/GeneratedCode/Quantities/AmplitudeRatio.Common.g.cs

Lines changed: 2 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -81,21 +81,11 @@ static AmplitudeRatio()
8181
{
8282
}
8383

84-
/// <summary>
85-
/// Creates the quantity with the given value in the base unit DecibelVolt.
86-
/// </summary>
87-
[Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")]
88-
public AmplitudeRatio(double decibelvolts)
89-
{
90-
_value = Convert.ToDouble(decibelvolts);
91-
_unit = BaseUnit;
92-
}
93-
9484
/// <summary>
9585
/// Creates the quantity with the given numeric value and unit.
9686
/// </summary>
9787
/// <param name="numericValue">Numeric value.</param>
98-
/// <param name="unit">Unit representation.</param>
88+
/// <param name="unit">The unit representation to contruct this quantity with.</param>
9989
/// <remarks>Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component.</remarks>
10090
#if WINDOWS_UWP
10191
private
@@ -108,33 +98,6 @@ public AmplitudeRatio(double decibelvolts)
10898
_unit = unit;
10999
}
110100

111-
// Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods
112-
/// <summary>
113-
/// Creates the quantity with the given value assuming the base unit DecibelVolt.
114-
/// </summary>
115-
/// <param name="decibelvolts">Value assuming base unit DecibelVolt.</param>
116-
#if WINDOWS_UWP
117-
private
118-
#else
119-
[Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")]
120-
public
121-
#endif
122-
AmplitudeRatio(long decibelvolts) : this(Convert.ToDouble(decibelvolts), BaseUnit) { }
123-
124-
// Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods
125-
// Windows Runtime Component does not support decimal type
126-
/// <summary>
127-
/// Creates the quantity with the given value assuming the base unit DecibelVolt.
128-
/// </summary>
129-
/// <param name="decibelvolts">Value assuming base unit DecibelVolt.</param>
130-
#if WINDOWS_UWP
131-
private
132-
#else
133-
[Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")]
134-
public
135-
#endif
136-
AmplitudeRatio(decimal decibelvolts) : this(Convert.ToDouble(decibelvolts), BaseUnit) { }
137-
138101
#region Properties
139102

140103
/// <summary>
@@ -143,7 +106,7 @@ public AmplitudeRatio(double decibelvolts)
143106
public static QuantityType QuantityType => QuantityType.AmplitudeRatio;
144107

145108
/// <summary>
146-
/// The base unit representation of this quantity for the numeric value stored internally. All conversions go via this value.
109+
/// The base unit of AmplitudeRatio, which is DecibelVolt. All conversions go via this value.
147110
/// </summary>
148111
public static AmplitudeRatioUnit BaseUnit => AmplitudeRatioUnit.DecibelVolt;
149112

@@ -297,16 +260,6 @@ int CompareTo(AmplitudeRatio other)
297260
return _value.CompareTo(other.AsBaseNumericType(this.Unit));
298261
}
299262

300-
[Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")]
301-
public override bool Equals(object obj)
302-
{
303-
if(obj is null || !(obj is AmplitudeRatio))
304-
return false;
305-
306-
var objQuantity = (AmplitudeRatio)obj;
307-
return _value.Equals(objQuantity.AsBaseNumericType(this.Unit));
308-
}
309-
310263
/// <summary>
311264
/// <para>
312265
/// Compare equality to another AmplitudeRatio within the given absolute or relative tolerance.
@@ -358,20 +311,6 @@ public bool Equals(AmplitudeRatio other, double tolerance, ComparisonType compar
358311
return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType);
359312
}
360313

361-
/// <summary>
362-
/// Compare equality to another AmplitudeRatio by specifying a max allowed difference.
363-
/// Note that it is advised against specifying zero difference, due to the nature
364-
/// of floating point operations and using System.Double internally.
365-
/// </summary>
366-
/// <param name="other">Other quantity to compare to.</param>
367-
/// <param name="maxError">Max error allowed.</param>
368-
/// <returns>True if the difference between the two values is not greater than the specified max.</returns>
369-
[Obsolete("Please use the Equals(AmplitudeRatio, double, ComparisonType) overload. This method will be removed in a future version.")]
370-
public bool Equals(AmplitudeRatio other, AmplitudeRatio maxError)
371-
{
372-
return Math.Abs(_value - other.AsBaseNumericType(this.Unit)) <= maxError.AsBaseNumericType(this.Unit);
373-
}
374-
375314
/// <summary>
376315
/// Returns the hash code for this instance.
377316
/// </summary>
@@ -504,12 +443,6 @@ public static AmplitudeRatioUnit ParseUnit(string str)
504443

505444
#endregion
506445

507-
/// <summary>
508-
/// Set the default unit used by ToString(). Default is DecibelVolt
509-
/// </summary>
510-
[Obsolete("This is no longer used since we will instead use the quantity's Unit value as default.")]
511-
public static AmplitudeRatioUnit ToStringDefaultUnit { get; set; } = AmplitudeRatioUnit.DecibelVolt;
512-
513446
/// <summary>
514447
/// Get default string representation of value and unit.
515448
/// </summary>

0 commit comments

Comments
 (0)