我有一个具有 4 个值的枚举:
public enum DriveRates
{
driveSidereal = 0,
driveLunar = 1,
driveSolar = 2,
driveKing = 3
}
我有一个要转换为 DriveRates 数组的值数组。但是,当我这样做时var rates = (DriveRates[])ret;
,它ret
是一个数字对象数组(可能是整数),它说Unable to cast object of type 'System.Object[]' to type 'ASCOM.DeviceInterface.DriveRates[]'.
ret
= {0,1,2,3}
。我应该怎么做呢。同样,我正在尝试将枚举值数组转换为枚举数组...嗯,值 :) 但我正在尝试从 type 转换object[]
为 type DriveRates[]
。