Created
January 29, 2015 12:34
-
-
Save kjnilsson/be28e7d43e9b963c4455 to your computer and use it in GitHub Desktop.
sharp and equality
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class CodeListElement | |
{ | |
private readonly int codeContext; | |
private readonly string value; | |
public CodeListElement(int codeContext, string value) | |
{ | |
this.codeContext = codeContext; | |
this.value = value; | |
} | |
public string Value | |
{ | |
get { return this.value; } | |
} | |
public int CodeContext | |
{ | |
get { return this.codeContext; } | |
} | |
protected bool Equals(PadisCodeListElement other) | |
{ | |
return codeContext == other.codeContext && string.Equals(value, other.value); | |
} | |
public override bool Equals(object obj) | |
{ | |
if (ReferenceEquals(null, obj)) return false; | |
if (ReferenceEquals(this, obj)) return true; | |
if (obj.GetType() != this.GetType()) return false; | |
return Equals((PadisCodeListElement) obj); | |
} | |
public override int GetHashCode() | |
{ | |
unchecked | |
{ | |
return (codeContext*397) ^ (value != null ? value.GetHashCode() : 0); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment