access a single value from list

I am very new to C#, I hope this is a simple question but I have not been able to find the answer, Thank you for any help you are able to provide.

I have a list of items pulled from a database.

public List<ListModel> my List

This is pretty much 3 columns of numbers

Header1 Header 2 Header 3
1               2               2
1               2               2
3               3               1
1               2               3


I would like to place those values into a html table in various cells. I cant build the table in a foreach as the values may need to be spread out in a non repeating manor .

In other languages you could access an array by myArray [1][2] , How can this be done in in a list I am passing from a controller to a view?

Thank you
Justin HullAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Chris StanyonWebDevCommented:
You can use the array operator to get a specific instance:

myArray[1]

This will return an instance of your ListModel class, so you can access the properties just like any other object.

myArray[1].PropertyName

Bear in mind that the indexes may change if you order your list.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Justin HullAuthor Commented:
Thank you, that did it
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.