TypeConverter for object type Properties



I have a property with a member of type object. I am showing the value of
this property in a PropertyGrid but depending on the type of the object I
want to use the correspondant TypeConverter. Here is an example of what I
mean:

public byte[] Test
{
get { return new byte[100]; }
}

public object Test2
{
get { return new byte[100]; }
}

If I have both properties in a property grid, Test will be shown as an
expandable item with the text "Byte[] Array".. if I expand the item I will
be able to see all of the elements in the array. However, Test2 will only
show the text "System.Byte[]" and I will have no way of reading the
elements of the array.

Of course the property of type object will not always contain a byte[].

How can I provide the standard functionality for each type?

Thanks
.



Relevant Pages

  • Re: I cant extract string data from a type object
    ... > I am calling a COM object that returns a type Object and ... > it contains two strings but I can't get them out. ... > object ParamNameObj= localxPCCOMOBJ.xPCTarget.GetParamName ... Could you show *how* you've tried to use it as an array? ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: How to know the size of array
    ... sizeof foo will return the total number of bytes taken up by the whole ... single array element, so yes, the expression ... what actually gets passed to bar is a pointer type object, ...
    (comp.lang.c)
  • Re: Associative with MultiDimensional arrays
    ... do not exist in the nature. ... There objects of type Object with ... You can create an object and store array references as its properties: ...
    (comp.lang.javascript)
  • Re: Associative with MultiDimensional arrays
    ... do not exist in the nature. ... There objects of type Object with ... You can create an object and store array references as its properties: ...
    (comp.lang.javascript)
  • Re: arrays newbie
    ... This is how i copy an ArrayList to Array: ... > I have an ArrayList object and I want to transform it into an array like ... > My problem is that the ToArray method take a type object in parameter. ...
    (microsoft.public.dotnet.languages.csharp)