Rediger

Del via


LocalizableAttribute.IsLocalizable Property

Definition

Gets a value indicating whether a property should be localized.

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

Property Value

true if a property should be localized; otherwise, false.

Examples

The following example shows how to check the value of the LocalizableAttribute for MyProperty. First, the code gets a PropertyDescriptorCollection with all the properties for the object. Then, the code gets MyProperty from the PropertyDescriptorCollection. Next, it returns the attributes for this property and saves them in the attributes variable.

Finally, the code sets myAttribute to the value of the LocalizableAttribute in the AttributeCollection and checks whether the property needs to be localized.

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

Applies to

See also