.NET Framework 4.5.2+
.NET Framework 4.5.2+
.NET Standard 2.0+
The page you are viewing does not exist in the .NET Standard 2.0+ platform documentation. This link will take you to the parent topic of the current section.
.NET Core 3.0+
The page you are viewing does not exist in the .NET Core 3.0+ platform documentation. This link will take you to the parent topic of the current section.

ImageValueConverter Class

A Value Converter which can be used to convert Image objects to an array of bytes.

Namespace: DevExpress.Xpo.Metadata

Assembly: DevExpress.Xpo.v20.1.dll

Declaration

public class ImageValueConverter :
    ValueConverter
Public Class ImageValueConverter
    Inherits ValueConverter

Remarks

The following example shows how to convert the value of the Image property to an array of bytes when saving it in a data store.

using DevExpress.Xpo;

public class SampleImageClass : XPObject {
    private System.Drawing.Image image;
    public SampleImageClass(Session session) : base(session) {}

    [ValueConverter(typeof(DevExpress.Xpo.Metadata.ImageValueConverter))]
    public System.Drawing.Image Image {
        get { return image; }
        set {
            SetPropertyValue(nameof(Image) , ref image, value);
        }
    }
}

If ImageValueConverter is not available under the target platform (for example, .NET Core), change the property type to System.Byte[].

using DevExpress.Xpo;

[Delayed]
public byte[] Image {
    get { return GetDelayedPropertyValue(nameof(Image)); }
    set { SetDelayedPropertyValue<byte[]>(nameof(Image), value); }
}

Inheritance

Object
ValueConverter
ImageValueConverter
See Also