/////////////////////////////////////////////////////////////////////// public static StringSortedList GetRange( IList list, int firstIndex, int lastIndex ) { StringSortedList range = null; if (list != null) { range = new StringSortedList(); for (int index = firstIndex; index <= lastIndex; index++) { if (list[index] == null) { continue; } range.Add(list[index].ToString(), null); } } return(range); }
/////////////////////////////////////////////////////////////////////// public static Result ListOptions( OptionDictionary options, bool safe ) { if (options == null) { return("there are no available options"); } IDictionary <string, string> dictionary; if (safe) { dictionary = new StringSortedList(); foreach (KeyValuePair <string, IOption> pair in options) { IOption option = pair.Value; if ((option == null) || option.IsUnsafe(options)) { continue; } string name = pair.Key; if (name == null) { continue; } dictionary.Add(name, null); } } else { dictionary = new StringSortedList(options.Keys); } return(String.Format( "available options are {0}", ToEnglish(dictionary))); }