Home > DeveloperSection > Forums > List<Class> to List<string>
Manoj Bhatt
Manoj Bhatt

Total Post:153

Points:1079
Posted on    January-31-2014 11:34 PM

 C# C# 
Ratings:


 1 Reply(s)
 1184  View(s)
Rate this:

public class emp

{

    public int id { get; set; }

    public string name { get; set; }

}

public class employee

{

    public List<emp> Result { get; set; }

}

I want to convert above class

List<employee> e=new List<employee>();

to

List<string> onj =new  List<string>();

Can anyone guide me? Thanks in advance.



Pravesh Singh

Total Post:411

Points:2881
Posted on    January-31-2014 11:45 PM

Hi Manoj,

Try this:

List<String> onj = e.Select(employee => employee.Name).ToList();


Don't want to miss updates? Please click the below button!

Follow MindStick