更新时间:2023-02-04 09:48:36
您不知道.如果您想要一个双精度数组,可以尝试一下.
You don''t. If you want an array of doubles, you can try this.
double value1 = 0.0;
double[] valueArray = new double[1];
valueArray[0] = value1;
或
or
double value1 = 0.0;
double[] valueArray = new double[]{value1};
通常来说,没有这种转换.您为什么要提出要求(即确切地知道您的要求,也许我们可以为您提供解决方案?)?
Generally speaking there is NOT such a conversion. Why are you asking for (i.e. knowing exactly your requirements maybe we can provide you a work around)?
,或者通常是
public static T[] ToArray<T>(T t)
{
return new T[] { t };
}
public static Array ToArray(Object o)
{
Array result = Array.CreateInstance(o.GetType(), 1);
result.SetValue(o, 0);
return result;
}