Freigeben über


LocalizableAttribute.IsLocalizable-Eigenschaft

Ruft einen Wert ab, der angibt, ob eine Eigenschaft lokalisiert werden soll.

Namespace: System.ComponentModel
Assembly: System (in system.dll)

Syntax

'Declaration
Public ReadOnly Property IsLocalizable As Boolean
'Usage
Dim instance As LocalizableAttribute
Dim value As Boolean

value = instance.IsLocalizable
public bool IsLocalizable { get; }
public:
property bool IsLocalizable {
    bool get ();
}
/** @property */
public boolean get_IsLocalizable ()
public function get IsLocalizable () : boolean

Eigenschaftenwert

true, wenn eine Eigenschaft lokalisiert werden soll, andernfalls false.

Beispiel

Im folgenden Beispiel wird veranschaulicht, wie der Wert von LocalizableAttribute für MyProperty überprüft wird. Zunächst wird im Code eine PropertyDescriptorCollection mit allen Eigenschaften für das Objekt abgerufen. Anschließend ruft der Code MyProperty aus PropertyDescriptorCollection ab. Dann werden die Attribute für diese Eigenschaft zurückgegeben und in der attributes-Variablen gespeichert.

Abschließend legt der Code myAttribute auf den Wert von LocalizableAttribute in der AttributeCollection fest und überprüft, ob die Eigenschaft lokalisiert werden muss.

' 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.
}

Plattformen

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 unterstützt nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen.

Versionsinformationen

.NET Framework

Unterstützt in: 2.0, 1.1, 1.0

Siehe auch

Referenz

LocalizableAttribute-Klasse
LocalizableAttribute-Member
System.ComponentModel-Namespace
LocalizableAttribute-Klasse
Attribute
PropertyDescriptor
AttributeCollection-Klasse
PropertyDescriptorCollection