public class Ticker
{
public string Symbol { get; set; }
public string Market { get; set; }
public Ticker(string symbol, string market)
{
Symbol = symbol;
Market = market;
}
public Ticker(string fullsymbol)
{
var p = fullsymbol.Split('.');
if (p.Length != 2) throw new ArgumentException();
Symbol = p[0];
Market = p[1];
}
public string FullSymbol
{
get
{
return Symbol + "." + Market;
}
}
//REF: https://msdn.microsoft.com/en-us/library/ms173147(v=vs.90).aspx
public override bool Equals(System.Object obj)
{
// If parameter is null return false.
if (obj == null) return false;
// If parameter cannot be cast to Point return false.
Ticker p = obj as Ticker;
if ((System.Object)p == null) return false;
// Return true if the fields match:
return FullSymbol == p.FullSymbol;
}
public bool Equals(Ticker p)
{
// If parameter is null return false:
if ((object)p == null) return false;
// Return true if the fields match:
return FullSymbol == p.FullSymbol;
}
public override int GetHashCode()
{
return FullSymbol.GetHashCode();
}
public static bool operator ==(Ticker a, Ticker b)
{
// If both are null, or both are same instance, return true.
if (System.Object.ReferenceEquals(a, b)) return true;
// If one is null, but not both, return false.
if (((object)a == null) || ((object)b == null)) return false;
// Return true if the fields match:
return a.FullSymbol == b.FullSymbol;
}
public static bool operator !=(Ticker a, Ticker b)
{
return !(a == b);
}
}