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

<AttributeUsageAttribute(AttributeTargets.All)> _ Public NotInheritable Class LocalizableAttribute Inherits Attribute
[AttributeUsageAttribute(AttributeTargets.All)] public sealed class LocalizableAttribute : Attribute
[AttributeUsageAttribute(AttributeTargets::All)] public ref class LocalizableAttribute sealed : public Attribute

コンポーネントのコードが生成された時点で、LocalizableAttribute に true を設定してマークされたメンバのプロパティ値はリソース ファイルに保存されています。これらのリソース ファイルは、コードを変更せずにローカライズできます。
既定では、ローカライズできる属性のないメンバまたは LocalizableAttribute に false を設定してマークされたメンバは、そのデータ型で許可されていれば、それぞれのプロパティ値をコードに対して永続化します。それ以外の場合、メイン コンポーネントが Localizable に設定されていれば、すべてのプロパティはリソース ファイルに対して永続化されます。既定値は false です。
![]() |
---|
LocalizableAttribute に true を設定してプロパティをマークすると、この属性の値は定数メンバ Yes に設定されます。LocalizableAttribute に false を設定してマークされたプロパティの場合、値は No になります。したがって、コード内でこの属性の値を確認する場合は、属性を LocalizableAttribute.Yes または LocalizableAttribute.No として指定する必要があります。 |
詳細については、属性の概要、属性を使用したメタデータの拡張 の各トピックを参照してください。

プロパティをローカライズする必要があるとしてマークする例を次に示します。
<Localizable(True)> _ Public Property MyProperty() As Integer Get ' Insert code here. Return 0 End Get Set ' Insert code here. End Set End Property
[Localizable(true)] public int MyProperty { get { // Insert code here. return 0; } set { // Insert code here. } }
public: property int MyProperty { [Localizable(true)] int get() { // Insert code here. return 0; } void set( int value ) { // Insert code here. } }
/** @attribute Localizable(true) */ /** @property */ public int get_MyProperty() { // Insert code here. return 0; }//get_MyProperty /** @property */ public void set_MyProperty(int value) { // Insert code here. }//set_MyProperty
public Localizable(true) function get MyProperty() : int{ // Insert code here. Property goes on getter only when a property has // both a getter and setter. return 0 } function set MyProperty(value: int){ // Insert code here. }
MyProperty の LocalizableAttribute の値を確認する方法を次の例に示します。最初に、オブジェクトのすべてのプロパティを保持する PropertyDescriptorCollection を取得します。次に、PropertyDescriptorCollection から MyProperty を取得します。そして、このプロパティの属性を返し、その属性を属性変数に保存します。
最後に、myAttribute を AttributeCollection にある LocalizableAttribute の値に設定し、プロパティをローカライズする必要があるかどうかを確認します。
' Gets the attributes for the property. Dim attributes As AttributeCollection = TypeDescriptor.GetProperties(Me)("MyProperty").Attributes ' Checks to see if the property needs to be localized. Dim myAttribute As LocalizableAttribute = CType(attributes(GetType(LocalizableAttribute)), LocalizableAttribute) If myAttribute.IsLocalizable Then ' Insert code here. End If
// Gets the attributes for the property. AttributeCollection attributes = TypeDescriptor.GetProperties(this)["MyProperty"].Attributes; // Checks to see if the property needs to be localized. LocalizableAttribute myAttribute = (LocalizableAttribute)attributes[typeof(LocalizableAttribute)]; if(myAttribute.IsLocalizable) { // Insert code here. }
// Gets the attributes for the property. AttributeCollection^ attributes = TypeDescriptor::GetProperties( this )[ "MyProperty" ]->Attributes; // Checks to see if the property needs to be localized. LocalizableAttribute^ myAttribute = dynamic_cast<LocalizableAttribute^>(attributes[ LocalizableAttribute::typeid ]); if ( myAttribute->IsLocalizable ) { // Insert code here. }
// Gets the attributes for the property. AttributeCollection attributes = TypeDescriptor.GetProperties(this). get_Item("MyProperty").get_Attributes(); // Checks to see if the property needs to be localized. LocalizableAttribute myAttribute = (LocalizableAttribute)(attributes. get_Item(LocalizableAttribute.class.ToType())); if (myAttribute.get_IsLocalizable()) { // Insert code here. }
// Gets the attributes for the property. var attributes : AttributeCollection = TypeDescriptor.GetProperties(this)["MyProperty"].Attributes // Checks to see if the property needs to be localized. var myAttribute : LocalizableAttribute = LocalizableAttribute(attributes(LocalizableAttribute)) if(myAttribute.IsLocalizable){ // Insert code here. }

System.Attribute
System.ComponentModel.LocalizableAttribute


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 によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


LocalizableAttribute コンストラクタ
アセンブリ: System (system.dll 内)


プロパティをローカライズする必要があるとしてマークする例を次に示します。このコードは、新しい LocalizableAttribute を作成し、その値を LocalizableAttribute.Yes に設定してから、その属性をプロパティに関連付けます。
<Localizable(True)> _ Public Property MyProperty() As Integer Get ' Insert code here. Return 0 End Get Set ' Insert code here. End Set End Property
[Localizable(true)] public int MyProperty { get { // Insert code here. return 0; } set { // Insert code here. } }
[Localizable(true)] int get() { // Insert code here. return 0; } void set( int value ) { // Insert code here. } }

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 によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


LocalizableAttribute フィールド

名前 | 説明 | |
---|---|---|
![]() | Default | 既定の値である No を指定します。static フィールドは読み取り専用です。 |
![]() | No | プロパティをローカライズする必要がないことを指定します。static フィールドは読み取り専用です。 |
![]() | Yes | プロパティをローカライズすることを指定します。static フィールドは読み取り専用です。 |

関連項目
LocalizableAttribute クラスSystem.ComponentModel 名前空間
Attribute
PropertyDescriptor
AttributeCollection クラス
PropertyDescriptorCollection
LocalizableAttribute プロパティ

名前 | 説明 | |
---|---|---|
![]() | IsLocalizable | プロパティをローカライズする必要があるかどうかを示す値を取得します。 |
![]() | TypeId | 派生クラスに実装されている場合は、この Attribute の一意の識別子を取得します。 ( Attribute から継承されます。) |

関連項目
LocalizableAttribute クラスSystem.ComponentModel 名前空間
Attribute
PropertyDescriptor
AttributeCollection クラス
PropertyDescriptorCollection
LocalizableAttribute メソッド

名前 | 説明 | |
---|---|---|
![]() | Equals | オーバーロードされます。 オーバーライドされます。 指定したオブジェクトの値が現在の LocalizableAttribute と等しいかどうかを示す値を返します。 |
![]() | GetCustomAttribute | オーバーロードされます。 アセンブリ、モジュール、型のメンバ、またはメソッド パラメータに適用された指定した型のカスタム属性を取得します。 ( Attribute から継承されます。) |
![]() | GetCustomAttributes | オーバーロードされます。 アセンブリ、モジュール、型のメンバ、またはメソッド パラメータに適用されたカスタム属性の配列を取得します。 ( Attribute から継承されます。) |
![]() | GetHashCode | オーバーライドされます。 対象のインスタンスのハッシュ コードを返します。 |
![]() | GetType | 現在のインスタンスの Type を取得します。 ( Object から継承されます。) |
![]() | IsDefaultAttribute | オーバーライドされます。 この属性が既定値かどうかを判断します。 |
![]() | IsDefined | オーバーロードされます。 指定した型のカスタム属性が、アセンブリ、モジュール、型のメンバ、またはメソッド パラメータに適用されているかどうかを判断します。 ( Attribute から継承されます。) |
![]() | Match | 派生クラス内でオーバーライドされたときに、指定したオブジェクトとこのインスタンスが等しいかどうかを示す値を返します。 ( Attribute から継承されます。) |
![]() | ReferenceEquals | 指定した複数の Object インスタンスが同一かどうかを判断します。 ( Object から継承されます。) |
![]() | ToString | 現在の Object を表す String を返します。 ( Object から継承されます。) |

名前 | 説明 | |
---|---|---|
![]() | Finalize | Object がガベージ コレクションにより収集される前に、その Object がリソースを解放し、その他のクリーンアップ操作を実行できるようにします。 ( Object から継承されます。) |
![]() | MemberwiseClone | 現在の Object の簡易コピーを作成します。 ( Object から継承されます。) |

関連項目
LocalizableAttribute クラスSystem.ComponentModel 名前空間
Attribute
PropertyDescriptor
AttributeCollection クラス
PropertyDescriptorCollection
LocalizableAttribute メンバ
プロパティをローカライズする必要があるかどうかを指定します。このクラスは継承できません。
LocalizableAttribute データ型で公開されるメンバを以下の表に示します。


名前 | 説明 | |
---|---|---|
![]() | Default | 既定の値である No を指定します。static フィールドは読み取り専用です。 |
![]() | No | プロパティをローカライズする必要がないことを指定します。static フィールドは読み取り専用です。 |
![]() | Yes | プロパティをローカライズすることを指定します。static フィールドは読み取り専用です。 |

名前 | 説明 | |
---|---|---|
![]() | IsLocalizable | プロパティをローカライズする必要があるかどうかを示す値を取得します。 |
![]() | TypeId | 派生クラスに実装されている場合は、この Attribute の一意の識別子を取得します。(Attribute から継承されます。) |

名前 | 説明 | |
---|---|---|
![]() | Equals | オーバーロードされます。 オーバーライドされます。 指定したオブジェクトの値が現在の LocalizableAttribute と等しいかどうかを示す値を返します。 |
![]() | GetCustomAttribute | オーバーロードされます。 アセンブリ、モジュール、型のメンバ、またはメソッド パラメータに適用された指定した型のカスタム属性を取得します。 (Attribute から継承されます。) |
![]() | GetCustomAttributes | オーバーロードされます。 アセンブリ、モジュール、型のメンバ、またはメソッド パラメータに適用されたカスタム属性の配列を取得します。 (Attribute から継承されます。) |
![]() | GetHashCode | オーバーライドされます。 対象のインスタンスのハッシュ コードを返します。 |
![]() | GetType | 現在のインスタンスの Type を取得します。 (Object から継承されます。) |
![]() | IsDefaultAttribute | オーバーライドされます。 この属性が既定値かどうかを判断します。 |
![]() | IsDefined | オーバーロードされます。 指定した型のカスタム属性が、アセンブリ、モジュール、型のメンバ、またはメソッド パラメータに適用されているかどうかを判断します。 (Attribute から継承されます。) |
![]() | Match | 派生クラス内でオーバーライドされたときに、指定したオブジェクトとこのインスタンスが等しいかどうかを示す値を返します。 (Attribute から継承されます。) |
![]() | ReferenceEquals | 指定した複数の Object インスタンスが同一かどうかを判断します。 (Object から継承されます。) |
![]() | ToString | 現在の Object を表す String を返します。 (Object から継承されます。) |

名前 | 説明 | |
---|---|---|
![]() | Finalize | Object がガベージ コレクションにより収集される前に、その Object がリソースを解放し、その他のクリーンアップ操作を実行できるようにします。 (Object から継承されます。) |
![]() | MemberwiseClone | 現在の Object の簡易コピーを作成します。 (Object から継承されます。) |

関連項目
LocalizableAttribute クラスSystem.ComponentModel 名前空間
Attribute
PropertyDescriptor
AttributeCollection クラス
PropertyDescriptorCollection
- LocalizableAttributeのページへのリンク