Byte array in PropertyGrid

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Olav Langeland

    #1

    Byte array in PropertyGrid

    I have a C# Form with a System.Windows. Forms.PropertyG rid(). This uses a
    Datagram class, implemented in both C# and C++:

    // C#
    public class Datagram
    {
    public byte[] _Buffer;

    // some code...

    public byte[] Buffer { get{return _Buffer;}
    }

    // C++
    public __gc class Datagram
    {
    public:

    unsigned char* _ucharBuf;
    Byte _ByteBuf __gc[];

    // some code...

    public:
    __property byte* get_Buffer1() {return _ucharBuf;}
    __property Byte get_Buffer2() __gc[] {return _ByteBuf;}
    __property unsigned char __gc *get_Buffer3() {return _ucharBuf;}
    }

    When I use the C# Datagram class, the Property Grid looks like this:

    + Buffer Byte[] Array ...

    The "Byte Array Property Editor" is available when ... is clicked.

    When I use the C++ datagram class, Property Grid looks like this:

    Buffer1 System.Reflecti on.Pointer
    +Buffer2 Byte[] Array
    Buffer3 Specified method is not supported.

    I assume the C++

    __property Byte get_Buffer2() __gc[]

    is the best match for the C# equivalent.

    The "Byte Array Property Editor" seems to be unavailable when I use the C++
    class. How can I get the C++ class to be compliant with the C# class?






Working...