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

Total Post:153

Posted on    January-31-2014 11:34 PM

 C# C# 

 1 Reply(s)
 1142  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>();


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

Can anyone guide me? Thanks in advance.

Pravesh Singh

Total Post:411

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