/////////////////////////////////////////////////////////////////////// public IStringList ToList( string pattern, bool empty, bool noCase ) { StringPairList inputList; StringPairList outputList = new StringPairList(); if (empty) { inputList = this; } else { inputList = new StringPairList(); foreach (IPair <string> element in this) { if (element == null) { continue; } if (String.IsNullOrEmpty(element.X) && String.IsNullOrEmpty(element.Y)) { continue; } inputList.Add(element); } } ReturnCode code; Result error = null; code = GenericOps <IPair <string> > .FilterList( inputList, outputList, Index.Invalid, Index.Invalid, ToStringFlags.None, pattern, noCase, ref error); if (code != ReturnCode.Ok) { DebugOps.Complain(code, error); // // TODO: Return null in the error case here? // outputList = null; } return(outputList); }
/////////////////////////////////////////////////////////////////////// public StringPairList ToPairs( string pattern, bool noCase ) { StringPairList list = new StringPairList(); foreach (KeyValuePair <string, string> pair in this) { if ((pattern == null) || Parser.StringMatch(null, pair.Key, 0, pattern, 0, noCase)) { list.Add(pair.Key, pair.Value); } } return(list); }
/////////////////////////////////////////////////////////////////////// public string ToString( string separator, string pattern, bool empty, bool noCase ) { if (empty) { return(GenericOps <IPair <string> > .ListToString( this, Index.Invalid, Index.Invalid, ToStringFlags.None, separator, pattern, noCase)); } else { StringPairList result = new StringPairList(); foreach (IPair <string> element in this) { if (element == null) { continue; } if (String.IsNullOrEmpty(element.X) && String.IsNullOrEmpty(element.Y)) { continue; } result.Add(element); } return(GenericOps <IPair <string> > .ListToString( result, Index.Invalid, Index.Invalid, ToStringFlags.None, separator, pattern, noCase)); } }