/// <include file='Resources/DocComments.xml' path='DocComments/Member[@name="CalculationEngine.GetResult"]/*' /> public T GetResult <T>(string name) { ExpressionResultPair tail = this.GetTailWithValidate(name); if ((!object.ReferenceEquals(typeof(T), tail.ResultType))) { string msg = string.Format("The result type of '{0}' ('{1}') does not match the supplied type argument ('{2}')", name, tail.ResultType.Name, typeof(T).Name); throw new ArgumentException(msg); } GenericExpressionResultPair <T> actualTail = tail as GenericExpressionResultPair <T>; return(actualTail.Result); }
private void AddTemporaryHead(string headName) { GenericExpressionResultPair <int> pair = new GenericExpressionResultPair <int>(); pair.SetName(headName); if (MyNameNodeMap.ContainsKey(headName) == false) { MyDependencies.AddTail(pair); MyNameNodeMap.Add(headName, pair); } else { throw new ArgumentException(string.Format("An expression already exists at '{0}'", headName)); } }