To String List - CSharp System.Collections.Generic

CSharp examples for System.Collections.Generic:List

Description

To String List

Demo Code


using System.Linq;
using System.Text;
using System.Globalization;
using System.ComponentModel;
using System.Collections.Generic;
using System.Collections;

public class Main{
        public static List<string> ToStringList<T>(this IEnumerable<T> me, Func<T, string> stringConverter)
        {/* w w  w.  ja  v a 2s  .c  o m*/
            var res = new List<string>();

            foreach (var val in me)
            {
                res.Add(stringConverter(val));
            }

            return res;
        }
}

Related Tutorials