diff --git a/Consequences/Results/Result.cs b/Consequences/Results/Result.cs index be02e89..55d1a05 100644 --- a/Consequences/Results/Result.cs +++ b/Consequences/Results/Result.cs @@ -1,14 +1,22 @@ namespace USACE.HEC.Results; public class Result { - private ResultItem[] results; + private ResultItem[] _results; + + public Result(ResultItem[] results) + { + _results = results; + } // retrieve a ResultItem from a Result by name public ResultItem Fetch(string name) { - for (int i = 0; i < results.Length; i++) - if (results[i].ResultName == name) - return results[i]; - throw new Exception("Name not found."); + for (int i = 0; i < _results.Length; i++) + if (_results[i].ResultName == name) + return _results[i]; + // return empty ResultItem if not found + ResultItem item = new ResultItem(); + item.ResultName = name; + return item; } }