c# : how to read from specific index in List<person> -


i have class of persons , list collection list contains values of person class such :

list ilist has 2 values [0]={firstname,lastname} . [1]={firstname2,lastname2}

now when iterating list able print list want change value of parts of list e.g in index 1 if want change value of firstname2 firstname3 not able . can tell me how print list , on index changing value of index , i.e. firstname , secondname variable in person class can update values

according docs on msdn can use familiar index operator (like on use on arrays). mylist[1].lastname = "new last name"; should you.

docs here; http://msdn.microsoft.com/en-us/library/0ebtbkkc.aspx

keep in mind need bounds checking before access.


Comments

Popular posts from this blog

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

html - How to style widget with post count different than without post count -

url rewriting - How to redirect a http POST with urlrewritefilter -