Example #1
0
        /// <summary>
        /// Converts the string into an array of objects using the specified
        /// StringToOjbectDelegate to create the objects.
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="values"></param>
        /// <param name="delimiter"></param>
        /// <param name="stringToObj"></param>
        /// <returns></returns>
        public static T[] Split <T>(this string values, string delimiter, StringToObjectDelegate <T> stringToObj)
        {
            List <T> retVals = new List <T>();

            foreach (string item in StringExtensions.DelimitSplit(values, delimiter))
            {
                retVals.Add(stringToObj(item));
            }
            return(retVals.ToArray());
        }
Example #2
0
        public static T[] ToObjects <T>(this string[] values, StringToObjectDelegate <T> stringToObj)
        {
            List <T> retVal = new List <T>();

            foreach (string val in values)
            {
                retVal.Add(stringToObj(val));
            }
            return(retVal.ToArray());
        }
Example #3
0
 public static T ToObject <T>(this string value, StringToObjectDelegate <T> stringToObj)
 {
     return(stringToObj(value));
 }
Example #4
0
 public static T[] Split <T>(this string values, StringToObjectDelegate <T> stringToObj)
 {
     return(Split <T>(values, ",", stringToObj));
 }