日期:2014-05-19  浏览次数:20863 次

out 数组总是提示有些路竟没有赋值
private   void   CalculateSteps(   double   startWavelength,   double   stopWavelength,   double   stepWidth,   out   double[]   stepArray   )
{

if(startWavelength   <   stopWavelength)
{
if((stopWavelength   -   startWavelength)   >   stepWidth)
{
int   i   =   0; double   step   =   startWavelength;
do
{
stepArray[i]   =   step;     //就这一句
step   +=   stepWidth;
++i;
}
while((stopWavelength   -   step)   >   stepWidth);
stepArray[i]   =   stopWavelength;
}
else
{
stepArray   =   new   double[0];
throw   new   Exception( "The   value   between   start   and   stop   is   less   than   step   width. ");
}
}
else   if(startWavelength   >   stopWavelength)
{
if((startWavelength   -   stopWavelength)   >   stepWidth)
{
int   i   =   0; double   step   =   startWavelength;
while((step   -   stopWavelength)   >   stepWidth)
{
stepArray[i]   =   step;
step   -=   stepWidth;
++i;
}
stepArray[i]   =   stopWavelength;
}
else
{
stepArray   =   new   double[0];
throw   new   Exception( "The   value   between   start   and   stop   is   less   than   step   width. ");
}
}
else
{
stepArray   =   new   double[0];
throw   new   Exception( "The   start   and   stop   point   are   equal ");
}
}

------解决方案--------------------
2003用arraylist,2005用list <T>
------解决方案--------------------
out 型的要先对其进行赋值,在函数里也要,在调用函数的外部也要的
------解决方案--------------------
动态的数组还是用ArrayList
.net2.0的话可以用泛型集合