Click here to Skip to main content
15,916,091 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a collection with Employee details. I want to display only empnames. In the collection i have empid, empname, salary, deptid from this i want to display only empnames.

i am new to this.

please help me

thank you.
Posted

Assuming the collection is called Employees

C#
Employees.Select(emp => emp.empname)


You could transform this to a list, by calling toList:

C#
var employeeNames = Employees.Select(emp => emp.empname).ToList()
 
Share this answer
 
pls check
C#
NameValueCollection collection = GetCollection();
	Console.WriteLine(collection["Sam"]);
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900