ConfigurationPropertyAttribute.IsRequired Property

Gets or sets a value indicating whether the decorated element property is required.

Namespace: System.Configuration
Assembly: System.Configuration (in system.configuration.dll)

public bool IsRequired { get; set; }
/** @property */
public boolean get_IsRequired ()

/** @property */
public void set_IsRequired (boolean value)

public function get IsRequired () : boolean

public function set IsRequired (value : boolean)

Not applicable.

Property Value

true if the property is required; otherwise, false. The default is false.

The following example shows how to use the DefaultValue property.

[ConfigurationProperty("maxUsers", DefaultValue = (long)10000,  
    IsRequired=false)]
[LongValidator(MinValue = 1, MaxValue = 10000000,
    ExcludeRange = false)]
public long MaxUsers
{
    get
    {
        return (long)this["maxUsers"];
    }
    set
    {
        this["maxUsers"] = value;
    }
}

Windows 98, Windows Server 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0
Show: