-
Notifications
You must be signed in to change notification settings - Fork 8
/
FlatSize.cs
45 lines (38 loc) · 1.09 KB
/
FlatSize.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
using System;
using System.Runtime.CompilerServices;
namespace Flat
{
public readonly struct FlatSize
{
public readonly int Width;
public readonly int Height;
public FlatSize(int width, int height)
{
this.Width = width;
this.Height = height;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool Equals(FlatSize other)
{
return this.Width == other.Width && this.Height == other.Height;
}
public override bool Equals(object obj)
{
if(obj is FlatSize other)
{
return this.Equals(other);
}
return false;
}
public override int GetHashCode()
{
int result = new { this.Width, this.Height }.GetHashCode();
return result;
}
public override string ToString()
{
string result = string.Format("({0}, {1})", this.Width, this.Height);
return result;
}
}
}