什么是System.Double [*]的意思 [英] What does System.Double[*] mean

查看:175
本文介绍了什么是System.Double [*]的意思的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是创业板中的一些互操作code,我们反编译创建。我们无法弄清楚如何创建这个数组的一个实例,也不是什么类型的数组。

This gem was created in some interop code which we decompiled. We can't figure out how to create an instance of this array, nor what type of array it is.

看着 Type.GetElementType 给我,这是类型的数组双击,但我们不能弄清楚它是如何不同于 System.Double []

Looking at Type.GetElementType gives me that it is an array of type Double, but we can't figure out how it is different from System.Double[].

推荐答案

这是一个典型的互操作问题,该阵列在COM自动化服务器创建。这暴露了数组作为<一个href="http://msdn.microsoft.com/en-us/library/windows/desktop/ms221482%28v=vs.85%29.aspx">SafeArray,在CLR自动将其编组到.NET数组对象,并作为安全数组描述符中指定保持其结构。

This is a typical interop problem, the array was created in a COM Automation server. Which exposes the array as a SafeArray, the CLR automatically marshals them to a .NET array object and maintains its structure as specified in the safe array descriptor.

一个System.Double []数组是一个非常特殊的一种阵列中的CLR的,它是一个载体阵,它有它的第一个元素的索引为0。这些数组类型是高度优化的CLR。

A System.Double[] array is a very specific kind of array in the CLR, it is a "vector array" which has its first element at index 0. These kind of arrays are heavily optimized in the CLR.

与你得到了数组的问题在于,它具有一维,就像一个向量数组,但没有它的第一个元素的索引为0通用,如果你互操作与code用Visual Basic或FoxPro的例子。这样的code常常喜欢以启动数组索引1适用,然而任何事情。

The trouble with the array you got is that it has one dimension, like a vector array, but does not have its first element at index 0. Common if you interop with code written in Visual Basic or FoxPro for example. Such code often likes to start the array at index 1. Could be anything however.

C#不具有的语法糖来访问这样的阵列,则不能使用[]操作符来索引数组。你必须使用Array类的成员,ploddingly。所以:

C# does not have syntax sugar to access such an array, you cannot use the [] operator to index the array. You have to use the members of the Array class, ploddingly. So:

  • Array.GetLowerBound(0),告诉你从哪里开始索引数组
  • Array.GetUpperBound(0)告诉你能走多远
  • 阅读来自数组中的元素与Array.GetValue(指数)

这篇关于什么是System.Double [*]的意思的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆