Addendum: We could use the internal property Type.IsSzArray to check array vs. vector when importing, although I have mixed feeling about this.
On Wed, Sep 15, 2010 at 12:40 PM, Johannes Rudolph < [email protected]> wrote: > I know this is a very tangential thing that only a few people might run > into, but nonetheless I want to make sure this is handled correctly. > > > The CLR makes a distinction between vectors (zero based, single-dimensional > arrays) and arrays (n-dimensional, m-based) with {n e N} and {m e N0}. Since > the latter also includes the same semantics as a vector (1 dimensional > 0-based) confusion is possible. The use of these arrays is strongly > discouraged (and not CLS compliant) and exhibits horrible performance. > > Cecil is clever about this distinction and knows the difference, there's > only two quirks to it: > > 1. Importing a 1-dimensional array will always result in a vector. There's > no way to import a 1-dimensional, 0-based array (nor have I found a way to > create one). > 2. If a 1-dimensional, 0-based array is not a vector, the Suffix should > show [*] instead of [] (that's the System.Reflection behavior at least) > > I agree that there's no sensible reason anyone would want to > use 1-dimensional, 0-based arrays, but ask myself if this Import behavior > might change semantics unintentionally. > > Kind regards, > Johannes > -- -- mono-cecil
