LocalizableAttribute.IsLocalizable Eigenschaft
Definition
Wichtig
Einige Informationen beziehen sich auf Vorabversionen, die vor dem Release ggf. grundlegend überarbeitet werden. Microsoft übernimmt hinsichtlich der hier bereitgestellten Informationen keine Gewährleistungen, seien sie ausdrücklich oder konkludent.
Ruft einen Wert ab, der angibt, ob eine Eigenschaft lokalisiert werden soll.
public:
property bool IsLocalizable { bool get(); };
public bool IsLocalizable { get; }
member this.IsLocalizable : bool
Public ReadOnly Property IsLocalizable As Boolean
Eigenschaftswert
true
, wenn eine Eigenschaft lokalisiert werden soll, andernfalls false
.
Beispiele
Im folgenden Beispiel wird gezeigt, wie Sie den Wert des Werts LocalizableAttribute MyProperty
für . Zunächst ruft der Code alle PropertyDescriptorCollection Eigenschaften für das Objekt ab. Anschließend ruft MyProperty
der Code vom PropertyDescriptorCollection. Als Nächstes gibt sie die Attribute für diese Eigenschaft zurück und speichert sie in der Attributevariable.
Schließlich legt der Code den Wert des LocalizableAttribute Ins AttributeCollection fest myAttribute
und überprüft, ob die Eigenschaft lokalisiert werden muss.
// 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