.NET Framework 4.5.2+
.NET Framework 4.5.2+
.NET Standard 2.0+

SizeAttribute(Int32) Constructor

Initializes a new instance of the SizeAttribute class.

Namespace: DevExpress.Xpo

Assembly: DevExpress.Xpo.v21.1.dll

Declaration

public SizeAttribute(
    int size
)

Parameters

Name Type Description
size Int32

An integer value which specifies the maximum number of characters that can be stored. This value is assigned to the SizeAttribute.Size property.

Example

The following example applies the SizeAttribute to the FullName and Background properties. The maximum number of characters that can be stored in a database column which the FullName property is mapped to is 128. As for the Background property the unlimited size of the column it is mapped to is specified.

using DevExpress.Xpo;

class Customer : XPObject {
    private string fullName;
    private string background;

    [Size(128)]
    public string FullName {
        get { return fullName; }
        set { SetPropertyValue<string>(nameof(FullName), ref fullName, value); }
    }

    [Size(SizeAttribute.Unlimited)]
    public string Background {
        get { return background; }
        set { SetPropertyValue<string>(nameof(Background), ref background, value); }
    }
}
See Also