简体   繁体   中英

What type is System.Byte[*]

I'm being passed an object that returns "System.Byte[*]" when converted to string. This apparently isn't a standard one dimensional array of Byte objects ("System.Byte[]"), so what is it?

That's probably a single-dimensional array with a non-zero base.

Here's an example of how to create one:

using System;

class Test
{
    static void Main()
    {
        Array nonZeroBase = Array.CreateInstance
           (typeof(byte), new int[]{1}, new int[]{2});
        Console.WriteLine(nonZeroBase); // Prints byte[*]
    }
}

In CLR terminology this is called an array (rectangular arrays are also arrays) where single-dimensional, zero-based arrays are called vectors . (A multi-dimensional array would be printed as byte[,] though.)

You may be interested in this blog post which Marc Gravell posted just morning...

There is no ...[*] type in c# as far as I remember. Maybe you can find the API documentation for that library, that will show you what the type is really. Even if you don't have that, Visual Studio should show you the type when you try autocompletion on the method returning the object.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM