将浮动列表添加到另一个整数列表中 [英] Add float lists to another list of ints

查看:88
本文介绍了将浮动列表添加到另一个整数列表中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,



我有一张带有高度和半径值的花车'列表',如下所示:



Hello,

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

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





我已经倍增文件有不同的文件有不同的列表。例如:文件1有20个高度和半径值,

文件2有15个高度和半径值等,目前我将它们存储为上面给出的列表。我可以通过其id(即int值)访问每个文件,并且需要将20存储在第一个列表中,将15存储在第二个列表中,依此类推。我知道如何在C ++中做到这一点(即类变量和数组),但我是C#的新手。有关如何做到这一点的任何建议?这样的东西?



例如:



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:

<>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.

推荐答案

它不应该是列表。它应该是具有不同类型成员的类或结构,例如float,double,integer或其他任何类型。然后你需要有一个这样的类或结构的实例列表。



-SA
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


这篇关于将浮动列表添加到另一个整数列表中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆