UserScopedSettingAttribute クラス
アセンブリ: System (system.dll 内)

<AttributeUsageAttribute(AttributeTargets.Property)> _ Public NotInheritable Class UserScopedSettingAttribute Inherits SettingAttribute
[AttributeUsageAttribute(AttributeTargets.Property)] public sealed class UserScopedSettingAttribute : SettingAttribute
[AttributeUsageAttribute(AttributeTargets::Property)] public ref class UserScopedSettingAttribute sealed : public SettingAttribute

アプリケーション設定プロパティのスコープは、アプリケーション レベルまたはユーザー レベルに基づいています。カテゴリが示すように、アプリケーション スコープのプロパティは、アプリケーションのすべてのユーザーに対して同じ値を提供しますが、ユーザー スコープのプロパティは、アプリケーションのユーザーごとに個別の値を提供します。
UserScopedSettingAttribute は、プロパティがユーザー レベルの設定と見なされること、およびこれに応じて設定プロバイダが適切なストレージを決定する必要があることを示します。
スコープ属性は、アプリケーション設定プロパティごとに必要です。プロパティに ApplicationScopedSettingAttribute または UserScopedSettingAttribute が適用されない場合、設定プロバイダはそのプロパティを無視し、プロパティはシリアル化されません。ただし、両方の属性を同じ設定プロパティに適用することはできません。両方の属性を適用しようとすると、ConfigurationErrorsException がスローされます。

ApplicationSettingsBase クラスから派生した FormSettings ラッパー クラスの 4 つのプロパティすべてに適用される UserScopedSettingAttribute の使用方法を示すコード例を次に示します。このクラスは、フォームの位置、サイズ、背景色、およびテキストを永続化させるために使用します。完全なコード例は、ApplicationSettingsBase クラスの概要に記載されています。
//Application settings wrapper class sealed class FormSettings : ApplicationSettingsBase { [UserScopedSettingAttribute()] public String FormText { get { return (String)this["FormText"]; } set { this["FormText"] = value; } } [UserScopedSetting()] [DefaultSettingValueAttribute("0, 0")] public Point FormLocation { get { return (Point)(this["FormLocation"]); } set { this["FormLocation"] = value; } } [UserScopedSetting()] [DefaultSettingValueAttribute("225, 200")] public Size FormSize { get { return (Size)this["FormSize"]; } set { this["FormSize"] = value; } } [UserScopedSetting()] [DefaultSettingValueAttribute("LightGray")] public Color FormBackColor { get { return (Color)this["FormBackColor"]; } set { this["FormBackColor"] = value; } } }
//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: [UserScopedSetting()] [DefaultSettingValueAttribute("0, 0")] property Point FormLocation { Point get() { return (Point)(this["FormLocation"]); } void set( Point value ) { this["FormLocation"] = value; } } public: [UserScopedSetting()] [DefaultSettingValueAttribute("225, 200")] property Size FormSize { Size get() { return (Size)this["FormSize"]; } void set( Size value ) { this["FormSize"] = value; } } public: [UserScopedSetting()] [DefaultSettingValueAttribute("LightGray")] property Color FormBackColor { Color get() { return (Color)this["FormBackColor"]; } void set(Color value) { this["FormBackColor"] = value; } } };

System.Attribute
System.Configuration.SettingAttribute
System.Configuration.UserScopedSettingAttribute


Windows 98, Windows 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
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Weblioに収録されているすべての辞書からUserScopedSettingAttribute クラスを検索する場合は、下記のリンクをクリックしてください。

- UserScopedSettingAttribute クラスのページへのリンク