Reputation: 155
This is my generic list. I would like to return the object CompanyEmail by finding the object based on the index. How do I do this ?
List<CompanyEmail> companyEmail = (List<CompanyEmail>)ViewState["companyEmail"];
Upvotes: 0
Views: 8350
Reputation: 600
why on index, you may use the Dictionary Class (it's generic too). http://msdn.microsoft.com/en-us/library/xfhwa508.aspx
hope I got you right.
Upvotes: 1
Reputation: 1204
try:
List<Data> data = new List<Data>();
Data temp = data[1];
in your list:
companyEmail[index];
Upvotes: 3
Reputation: 10847
This should do the trick:
http://msdn.microsoft.com/en-us/library/x1xzf2ca.aspx
Use:
List<T>.FindIndex(Predicate)
Upvotes: 0