Vba 类型语句到 C# 的转换 [英] Vba Type-Statement conversion to C#
问题描述
这可能很容易完成,但我在 VBA 中有以下语句:
This can probably be accomplished very easily but I have the following statement in VBA:
Type testType
integerArray(5 To 100) As Double
End Type
如何在 C# 中实现相同的功能?
How can I accomplish the same in C#?
@Edit 14:16 08-07-2015
@Edit 14:16 08-07-2015
在我看来,这与提到的问题不同.这是一个如何将Type语句转换成数组的问题.提到的问题只是关于一个带有起始索引的数组.
In my belief this is not the same as the question mentioned. This is a question how to convert the Type statement with an array inside. The question mentioned is only about an array with it's starting index.
推荐答案
实际上 C# 不支持那些基于任何其他起始索引然后为零的数组.
Actually C# does not support those kind of arrays based on any other start-index then zero.
无论如何你都可以.
double[] myArray = new double[96];
或者,您可以创建一个以索引作为键和实际值的字典:
Alternatvily you may create a dictionary with indexes as keys and the actual value:
var myDict = new Dictionary<int, double>();
这篇关于Vba 类型语句到 C# 的转换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!