wasSharp – Diff between revs 24 and 27
?pathlinks?
Rev 24 | Rev 27 | |||
---|---|---|---|---|
Line 23... | Line 23... | |||
23 | /// yMax - the upper bound of the target range |
23 | /// yMax - the upper bound of the target range |
|
24 | /// </remarks> |
24 | /// </remarks> |
|
25 | /// <returns>a value in x mapped in the range of y</returns> |
25 | /// <returns>a value in x mapped in the range of y</returns> |
|
26 | public static double MapValueToRange(double value, double xMin, double xMax, double yMin, double yMax) |
26 | public static double MapValueToRange(double value, double xMin, double xMax, double yMin, double yMax) |
|
27 | { |
27 | { |
|
28 | return yMin + (yMax - yMin)*(value - xMin)/(xMax - xMin); |
28 | return yMin + (yMax - yMin) * (value - xMin) / (xMax - xMin); |
|
29 | } |
29 | } |
|
Line 30... | Line 30... | |||
30 | |
30 | |
|
31 | public static bool IsNullOrDefault<T>(T value) |
31 | public static bool IsNullOrDefault<T>(T value) |
|
32 | { |
32 | { |
|
Line 36... | Line 36... | |||
36 | public static T DefaultOrValue<T>(this T initial, T value) |
36 | public static T DefaultOrValue<T>(this T initial, T value) |
|
37 | { |
37 | { |
|
38 | return Equals(initial, default(T)) ? value : initial; |
38 | return Equals(initial, default(T)) ? value : initial; |
|
39 | } |
39 | } |
|
40 | } |
40 | } |
|
41 | } |
- | ||
42 | |
41 | } |
|
- | 42 | |