diff options
Diffstat (limited to 'src/PriceListTools/Position.cs')
-rw-r--r-- | src/PriceListTools/Position.cs | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/src/PriceListTools/Position.cs b/src/PriceListTools/Position.cs index 0863642..713ba90 100644 --- a/src/PriceListTools/Position.cs +++ b/src/PriceListTools/Position.cs @@ -1,4 +1,6 @@ -namespace RehauSku.PriceListTools +using System.Linq; + +namespace RehauSku.PriceListTools { public class Position { @@ -12,5 +14,29 @@ Sku = sku; Name = name; } + + public override bool Equals(object obj) + { + if (obj as Position == null) + return false; + + Position other = obj as Position; + + return Group == other.Group && + Sku == other.Sku && + Name == other.Name; + } + + public override int GetHashCode() + { + string[] properties = new[] + { + Group, + Sku, + Name + }; + + return string.Concat(properties.Where(p => p != null)).GetHashCode(); + } } }
\ No newline at end of file |