c# - How to find item in ArrayList filled with list of userdefined class? -


arraylist contains list of items of type clspmlookupvalue

class clspmlookupvalue {     public string longvalue;     public string shortvalue;     public string value; } 

i want shortvalue arraylist item has value = 101202. in short want shortvalue checking value.
how that?
can using lambda expression or other way?

assuming arraylist declared way

system.collections.arraylist al = new system.collections.arraylist(); al.add(new clspmlookupvalue() { value = "101202", shortvalue = "shortvalue", longvalue = "longvalue" }); 

this way select shortvalue

string result = al.cast<clspmlookupvalue>().where(x => x.value == "101202").select(x => x.shortvalue).first(); 

Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -