public bool Equals(LookAroundType obj) { if (ReferenceEquals(null, obj)) { return(false); } if (ReferenceEquals(this, obj)) { return(true); } return(obj._negative.Equals(_negative) && obj._backward.Equals(_backward)); }
public static LookAroundType Parse(string s) { var splits = (s ?? "").ToLower().Split(','); if (splits.Length != 2) { throw new ArgumentException("Could not parse '" + s + "' as a LookAroundType"); } var result = new LookAroundType(); switch (splits[0]) { case positiveName: result.Positive = true; break; case negativeName: result.Positive = false; break; default: throw new ArgumentException("First part of a LookAroundType must be either " + positiveName + " or " + negativeName); } switch (splits[1]) { case forwardName: result.Forward = true; break; case backwardName: result.Forward = false; break; default: throw new ArgumentException("Second part of a LookAroundType must be either " + forwardName + " or " + backwardName); } return(result); }