internal KeyValuePair <Key, double>?FirstEventWhenLessOrEqual(Key from, double threshold) { if (Predicates.More(from, To)) { return(null); } if (Minimum > threshold) { return(null); } KeyValuePair <Key, double>?result = null; if ((null != FirstChild) && (null != SecondChild)) { result = FirstChild.FirstEventWhenLessOrEqual(from, threshold); if (null == result) { result = SecondChild.FirstEventWhenLessOrEqual(from, threshold); } return(result); } Debug.Assert(null == FirstChild); Debug.Assert(null == SecondChild); if ((Open <= threshold) && (Predicates.MoreOrEqual(From, from))) { result = new KeyValuePair <Key, double>(From, Open); } else if (Close <= threshold) { result = new KeyValuePair <Key, double>(To, Close); } return(result); }