BExplorer.Shell.FilterItem.ParseFilterString C# (CSharp) Method

ParseFilterString() public static method

Takes a string (representing a list of filters like: "txt|All files|") and converts it into a FilterItem[]
public static ParseFilterString ( string filterString, string existing, int &existingIndex ) : BExplorer.Shell.FilterItem[]
filterString string The string representing a list of filters like: "txt|All files|"
existing string Not Sure
existingIndex int Sets the index of the currently selected item in the
return BExplorer.Shell.FilterItem[]
        public static FilterItem[] ParseFilterString(string filterString, string existing, out int existingIndex)
        {
            var result = new List<FilterItem>();
            existingIndex = -1;

            string[] items = filterString != string.Empty ? filterString.Split('|') : new string[0];

            if ((items.Length % 2) != 0)
            {
                throw new ArgumentException(
                    @"Filter string you provided is not valid. The filter string must contain a description of the filter, 
					followed by the vertical bar (|) and the filter pattern. The strings for different filtering options must also be 
					separated by the vertical bar. Example: " + "\"Text files|*.txt|All files|*.*\""
                );
            }

            for (int n = 0; n < items.Length; n += 2)
            {
                var item = new FilterItem(items[n], items[n + 1]);
                result.Add(item);
                if (item.Filter == existing) existingIndex = result.Count - 1;
            }

            return result.ToArray();
        }
    }