Skip to content

Commit cd763c8

Browse files
committed
uwp: Add conditionals for Vector2/3 and Length2d
1 parent 59d340a commit cd763c8

File tree

3 files changed

+31
-2
lines changed

3 files changed

+31
-2
lines changed

UnitsNet/Length2d.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,26 @@
1919
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2020
// THE SOFTWARE.
2121

22+
#if !WINDOWS_UWP
2223
using System;
2324
using System.Collections.Generic;
2425
using UnitsNet.Units;
26+
#endif
2527

2628
namespace UnitsNet
2729
{
2830
/// <summary>
2931
/// A class for representing position in two dimensions.
3032
/// </summary>
33+
#if WINDOWS_UWP
34+
public struct Length2d
35+
{
36+
/// <summary>
37+
/// Returns a point represented in meters.
38+
/// </summary>
39+
public Vector2 Meters;
40+
}
41+
#else
3142
public struct Length2d : IEquatable<Length2d>
3243
{
3344
/// <summary>
@@ -244,4 +255,5 @@ public int GetHashCode(Length2d obj)
244255

245256
#endregion
246257
}
258+
#endif
247259
}

UnitsNet/Vector2.cs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,13 @@
2424

2525
namespace UnitsNet
2626
{
27+
#if WINDOWS_UWP
28+
public struct Vector2
29+
{
30+
public double X;
31+
public double Y;
32+
}
33+
#else
2734
public struct Vector2 : IEquatable<Vector2>
2835
{
2936
public readonly double X;
@@ -41,7 +48,7 @@ public Vector2(double xy) : this()
4148
Y = xy;
4249
}
4350

44-
#region Equality
51+
#region Equality
4552

4653
private static IEqualityComparer<Vector2> XyComparer { get; } = new XyEqualityComparer();
4754

@@ -90,11 +97,12 @@ public int GetHashCode(Vector2 obj)
9097
}
9198
}
9299

93-
#endregion
100+
#endregion
94101

95102
public override string ToString()
96103
{
97104
return $"[{X:0.####}, {Y:0.####}]";
98105
}
99106
}
107+
#endif
100108
}

UnitsNet/Vector3.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,14 @@
2424

2525
namespace UnitsNet
2626
{
27+
#if WINDOWS_UWP
28+
public struct Vector3
29+
{
30+
public double X;
31+
public double Y;
32+
public double Z;
33+
}
34+
#else
2735
public struct Vector3 : IEquatable<Vector3>
2836
{
2937
public readonly double X;
@@ -96,4 +104,5 @@ public override string ToString()
96104
return $"[{X:0.####}, {Y:0.####}, {Z:0.####}]";
97105
}
98106
}
107+
#endif
99108
}

0 commit comments

Comments
 (0)