LocalizableAttribute.IsLocalizable Özellik

Tanım

Bir özelliğin yerelleştirilmesi gerekip gerekmediğini belirten bir değer alır.

public:
 property bool IsLocalizable { bool get(); };
public bool IsLocalizable { get; }
member this.IsLocalizable : bool
Public ReadOnly Property IsLocalizable As Boolean

Özellik Değeri

true bir özelliğin yerelleştirilmesi gerekiyorsa; aksi takdirde , false.

Örnekler

Aşağıdaki örnekte için MyPropertydeğerinin nasıl denetlenecekleri gösterilmektedirLocalizableAttribute. İlk olarak kod, nesnenin tüm özellikleriyle bir PropertyDescriptorCollection alır. Ardından kod' dan PropertyDescriptorCollectionalırMyProperty. Ardından, bu özelliğin özniteliklerini döndürür ve öznitelikler değişkenine kaydeder.

Son olarak, kod içindeki AttributeCollection değerine LocalizableAttribute ayarlar myAttribute ve özelliğin yerelleştirilmesi gerekip gerekmediğini denetler.

// 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

Şunlara uygulanır

Ayrıca bkz.