LocalizableAttribute.IsLocalizable プロパティ
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
プロパティをローカライズするかどうかを示す値を取得します。
public:
property bool IsLocalizable { bool get(); };
public bool IsLocalizable { get; }
member this.IsLocalizable : bool
Public ReadOnly Property IsLocalizable As Boolean
プロパティ値
true プロパティをローカライズする必要がある場合。それ以外の場合は false。
例
次の例は、MyPropertyのLocalizableAttributeの値を確認する方法を示しています。 まず、コードは、オブジェクトのすべてのプロパティを含む PropertyDescriptorCollection を取得します。 その後、コードはPropertyDescriptorCollectionからMyPropertyされます。 次に、このプロパティの属性を返し、属性変数に保存します。
最後に、コードはmyAttributeAttributeCollection内のLocalizableAttributeの値に設定し、プロパティをローカライズする必要があるかどうかを確認します。
// 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)["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.
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