UserScopedSettingAttribute 클래스

정의

애플리케이션 설정 그룹이나 속성에 애플리케이션의 각 사용자에 대한 고유 값이 포함되어 있음을 지정합니다. 이 클래스는 상속될 수 없습니다.

public ref class UserScopedSettingAttribute sealed : System::Configuration::SettingAttribute
[System.AttributeUsage(System.AttributeTargets.Property)]
public sealed class UserScopedSettingAttribute : System.Configuration.SettingAttribute
[<System.AttributeUsage(System.AttributeTargets.Property)>]
type UserScopedSettingAttribute = class
    inherit SettingAttribute
Public NotInheritable Class UserScopedSettingAttribute
Inherits SettingAttribute
상속
UserScopedSettingAttribute
특성

예제

다음 코드 예제에서는 사용 하 여 사용 하 여 UserScopedSettingAttribute 보여 줍니다는 래퍼 클래스의 FormSettings 네 가지 속성에 적용 된 클래스에서 ApplicationSettingsBase 파생 되는 합니다. 이 클래스는 양식의 위치, 크기, 배경색 및 텍스트를 유지하는 데 사용됩니다. 전체 코드 예제는 클래스 개요에 ApplicationSettingsBase 나열됩니다.

//Application settings wrapper class
ref class FormSettings sealed: public ApplicationSettingsBase
{
public:
    [UserScopedSettingAttribute()]
    property String^ FormText
    {
        String^ get()
        {
            return (String^)this["FormText"];
        }
        void set( String^ value )
        {
            this["FormText"] = value;
        }
    }

public:
    [UserScopedSettingAttribute()]
    [DefaultSettingValueAttribute("0, 0")]
    property Point FormLocation
    {
        Point get()
        {
            return (Point)(this["FormLocation"]);
        }
        void set( Point value )
        {
            this["FormLocation"] = value;
        }
    }

public:
    [UserScopedSettingAttribute()]
    [DefaultSettingValueAttribute("225, 200")]
    property Size FormSize
    {
        Size get()
        {
            return (Size)this["FormSize"];
        }
        void set( Size value )
        {
            this["FormSize"] = value;
        }
    }

public:
    [UserScopedSettingAttribute()]
    [DefaultSettingValueAttribute("LightGray")]
    property Color FormBackColor
    {
        Color get()
        {
            return (Color)this["FormBackColor"];
        }
        void set(Color value)
        {
            this["FormBackColor"] = value;
        }
    }

};
//Application settings wrapper class
sealed class FormSettings : ApplicationSettingsBase
{
    [UserScopedSettingAttribute()]
    public String FormText
    {
        get { return (String)this["FormText"]; }
        set { this["FormText"] = value; }
    }

    [UserScopedSettingAttribute()]
    [DefaultSettingValueAttribute("0, 0")]
    public Point FormLocation
    {
        get { return (Point)(this["FormLocation"]); }
        set { this["FormLocation"] = value; }
    }

    [UserScopedSettingAttribute()]
    [DefaultSettingValueAttribute("225, 200")]
    public Size FormSize
    {
        get { return (Size)this["FormSize"]; }
        set { this["FormSize"] = value; }
    }

    [UserScopedSettingAttribute()]
    [DefaultSettingValueAttribute("LightGray")]
    public Color FormBackColor
    {
        get { return (Color)this["FormBackColor"]; }
        set { this["FormBackColor"] = value; }
    }
}
'Application settings wrapper class. This class defines the settings we intend to use in our application.
NotInheritable Class FormSettings
    Inherits ApplicationSettingsBase

    <UserScopedSettingAttribute()> _
    Public Property FormText() As String
        Get
            Return CStr(Me("FormText"))
        End Get
        Set(ByVal value As String)
            Me("FormText") = value
        End Set
    End Property

    <UserScopedSettingAttribute(), DefaultSettingValueAttribute("0, 0")> _
    Public Property FormLocation() As Point
        Get
            Return CType(Me("FormLocation"), Point)
        End Get
        Set(ByVal value As Point)
            Me("FormLocation") = value
        End Set
    End Property

    <UserScopedSettingAttribute(), DefaultSettingValueAttribute("225, 200")> _
    Public Property FormSize() As Size
        Get
            Return CType(Me("FormSize"), Size)
        End Get
        Set(ByVal value As Size)
            Me("FormSize") = value
        End Set
    End Property

    <UserScopedSettingAttribute(), DefaultSettingValueAttribute("LightGray")> _
    Public Property FormBackColor() As Color
        Get
            Return CType(Me("FormBackColor"), Color)
        End Get
        Set(ByVal value As Color)
            Me("FormBackColor") = value
        End Set
    End Property
End Class

설명

애플리케이션 설정 속성 애플리케이션 또는 사용자 수준 기반이 되는 범위를 있습니다. 범주에서 알 수 있듯이 사용자 범위 속성 전용 애플리케이션의 각 사용자에 대 한 값 반면 애플리케이션 범위 속성 애플리케이션의 모든 사용자에 게 균일 한 값을 제공 합니다.

UserScopedSettingAttribute은 속성을 사용자 수준 설정으로 간주해야 하며 적절한 스토리지 결정은 설정 공급자에 따라 이루어져야 함을 나타냅니다.

범위 특성은 각 애플리케이션 설정 속성에 필요 합니다. 속성이 또는 UserScopedSettingAttributeApplicationScopedSettingAttribute 적용되지 않으면 속성은 설정 공급자에 의해 무시됩니다. 직렬화되지 않습니다. 그러나 동일한 설정 속성에 두 특성을 모두 적용하는 것은 유효하지 않습니다. 이러한 시도로 인해 가 ConfigurationErrorsException throw됩니다.

생성자

UserScopedSettingAttribute()

UserScopedSettingAttribute 클래스의 새 인스턴스를 초기화합니다.

속성

TypeId

파생 클래스에서 구현된 경우 이 Attribute에 대한 고유 식별자를 가져옵니다.

(다음에서 상속됨 Attribute)

메서드

Equals(Object)

이 인스턴스가 지정된 개체와 같은지를 나타내는 값을 반환합니다.

(다음에서 상속됨 Attribute)
GetHashCode()

이 인스턴스의 해시 코드를 반환합니다.

(다음에서 상속됨 Attribute)
GetType()

현재 인스턴스의 Type을 가져옵니다.

(다음에서 상속됨 Object)
IsDefaultAttribute()

파생 클래스에서 재정의된 경우 이 인스턴스 값이 파생 클래스에 대한 기본값인지 여부를 표시합니다.

(다음에서 상속됨 Attribute)
Match(Object)

파생 클래스에서 재정의된 경우 이 인스턴스가 지정된 개체와 같은지 여부를 나타내는 값을 반환합니다.

(다음에서 상속됨 Attribute)
MemberwiseClone()

현재 Object의 단순 복사본을 만듭니다.

(다음에서 상속됨 Object)
ToString()

현재 개체를 나타내는 문자열을 반환합니다.

(다음에서 상속됨 Object)

명시적 인터페이스 구현

_Attribute.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr)

이름 집합을 해당하는 디스패치 식별자 집합에 매핑합니다.

(다음에서 상속됨 Attribute)
_Attribute.GetTypeInfo(UInt32, UInt32, IntPtr)

인터페이스의 형식 정보를 가져오는 데 사용할 수 있는 개체의 형식 정보를 검색합니다.

(다음에서 상속됨 Attribute)
_Attribute.GetTypeInfoCount(UInt32)

개체에서 제공하는 형식 정보 인터페이스의 수를 검색합니다(0 또는 1).

(다음에서 상속됨 Attribute)
_Attribute.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr)

개체에서 노출하는 메서드와 속성에 대한 액세스를 제공합니다.

(다음에서 상속됨 Attribute)

적용 대상

추가 정보