LocalizableAttribute.IsLocalizable Propiedad

Definición

Obtiene un valor que indica si se debe localizar una propiedad.

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

Valor de propiedad

true si se debe localizar una propiedad; de lo contrario, false.

Ejemplos

En el ejemplo siguiente se muestra cómo comprobar el valor de LocalizableAttribute para MyProperty. En primer lugar, el código obtiene con PropertyDescriptorCollection todas las propiedades del objeto . A continuación, el código obtiene MyProperty de .PropertyDescriptorCollection A continuación, devuelve los atributos de esta propiedad y los guarda en la variable attributes.

Por último, el código establece myAttribute en el valor de LocalizableAttribute en AttributeCollection y comprueba si la propiedad debe localizarse.

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

Se aplica a

Consulte también