求一个c#动态数组的写法,急用 我需要一个动态接收数据的数组 double类型的数据开始是0当数据大于0的时候开始存入数组当数据又变成0的时候结束接收 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 double [] d;int a=10d=new double[a];要不然用 List<double> d=new List<double>(); List<double> list=new List<double>;int num=5;//假如这个是你的数据if(num>0){ list.Add(num);} ArrayList List = new ArrayList();data[]...for(int i=0;i<data.Length;i++)if(data[i]>0){List.Add(data[i]>);} ArrayList List = new ArrayList();data[]...for(int i=0;i<data.Length;i++)if(data[i]>0){List.Add(data[i]);} 接收完以后如果需要仍得到一个数组double[] arr = new double[list.Count];list.CopyTo(arr); public class ABC { public event Action BeginReceive;//开始接收数据 public event Action EndReceive;//结束接收数据 private List<double> _list; bool isBegin = false; bool isEnd = false; public ABC() { _list = new List<double>(50); } public void Add(double value) { if (isEnd) return; if (value == 0 ) { if (isBegin) { isEnd = true; if (EndReceive != null) EndReceive(); } } else if (value > 0) { _list.Add( value ); if (!isBegin) { isBegin = true; if (BeginReceive != null) BeginReceive(); } } } public void Clear() { _list.Clear(); } } 泛型类 List,SortedList,Dictionary,......Array也可以用的 使用List<T>反序列化json 求一个排除“日本”的正则表达式 查找一个简单C#小程序错误 怎样使用下载的c#系统 DateTime无法加减时间 在线求正则表达式 Base-64 字符串中的无效字符 这是一个关于矩阵的问题!错误提示:索引超出数组界限 请指点! 在winform下,让datagrid自动对应列宽,有没详细点的方案啊?(高分) 到底是用session还是用cookie????(给分) c#画出的曲线怎么在指定的panel里显示 关于Show和showdialog问题
int a=10
d=new double[a];
要不然用
List<double> d=new List<double>();
int num=5;//假如这个是你的数据
if(num>0)
{
list.Add(num);
}
ArrayList List = new ArrayList();
data[]...
for(int i=0;i<data.Length;i++)
if(data[i]>0){
List.Add(data[i]>);
}
ArrayList List = new ArrayList();
data[]...
for(int i=0;i<data.Length;i++)
if(data[i]>0){
List.Add(data[i]);
}
接收完以后如果需要仍得到一个数组
double[] arr = new double[list.Count];
list.CopyTo(arr);
public class ABC
{
public event Action BeginReceive;//开始接收数据
public event Action EndReceive;//结束接收数据 private List<double> _list;
bool isBegin = false;
bool isEnd = false; public ABC() {
_list = new List<double>(50);
} public void Add(double value) {
if (isEnd)
return;
if (value == 0 ) {
if (isBegin) {
isEnd = true;
if (EndReceive != null)
EndReceive();
}
} else if (value > 0) {
_list.Add( value );
if (!isBegin) {
isBegin = true;
if (BeginReceive != null)
BeginReceive();
}
}
} public void Clear() {
_list.Clear();
}
}
Array也可以用的