Commons.Collections.ExtendedProperties.GetStringArray C# (CSharp) Method

GetStringArray() public method

Get an array of strings associated with the given configuration key. *
is thrown if the key maps to an /// object that is not a String/Vector. /// ///
public GetStringArray ( String key ) : String[]
key String The configuration key. ///
return String[]
        public String[] GetStringArray(String key)
        {
            Object value = this[key];

            // What's your vector, Victor?
            ArrayList vector;
            if (value is String)
            {
                vector = new ArrayList(1);
                vector.Add(value);
            }
            else if (value is ArrayList)
            {
                vector = (ArrayList) value;
            }
            else if (value == null)
            {
                if (defaults == null)
                {
                    return new String[0];
                }
                else
                {
                    return defaults.GetStringArray(key);
                }
            }
            else
            {
                throw new InvalidCastException(string.Format("{0}{1}' doesn't map to a String/Vector object", '\'', key));
            }

            String[] tokens = new String[vector.Count];
            for(int i = 0; i < tokens.Length; i++)
            {
                tokens[i] = (String) vector[i];
            }

            return tokens;
        }