Click here to Skip to main content
15,892,059 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hello,

I have a 'List' of floats with height and radius values as given below:

C#
List<float> WarningRadiusPoints = new List<float>();
List<float> WarningHeightPoints = new List<float>();


I have multipled files have different files have different lists. For eg: File 1 has 20 height and radius values,
File 2 has 15 height and radius values etc and at the moment I store them as lists as given above. I can access each file by its id i.e. int value and need to store the 20 in the first list, 15 in the second list and so on and so forth. I know how to do this in C++(i.e. class variables and arrays) but Im new to C#. Any suggestions on how to do this? Something like this?

For eg:
C#
<>List<int> ListofFiles = new List<int>();
    // After getting the data
    ListofFiles[0].WarningRadiusPoints...
// for accessing first files radius and height points .. etc

Kindly let me know.

Cheers.
Posted
Updated 19-Aug-13 5:45am
v2
Comments
[no name] 19-Aug-13 13:15pm    
A List can also contain Lists, just saying.... why do you need a separate list just to keep track of indexes?
[no name] 19-Aug-13 13:24pm    
List<List<float>> ListofFiles = new List<List<float>>();

1 solution

It should not be the list them. It should be a class or a structure with members of different types, such as float, double, integer or whatever else. And then you need to have a list of instanced of such class or structure.

—SA
 
Share this answer
 
Comments
Mobile.Instinct 20-Aug-13 4:30am    
Yes exactly that is what I am looking for. Could you please post an example? I know how to do such things in C++, but C# is a bit new to me.
Mobile.Instinct 20-Aug-13 7:53am    
Ok, I have worked out a solution based on your suggestion. Thanks for your input.
Sergey Alexandrovich Kryukov 20-Aug-13 10:35am    
Great. You a very welcome.
Good luck, call again.
—SA

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