LocalizableAttribute.IsLocalizable Propriedade
Definição
Importante
Algumas informações dizem respeito a um produto pré-lançado que pode ser substancialmente modificado antes de ser lançado. A Microsoft não faz garantias, de forma expressa ou implícita, em relação à informação aqui apresentada.
Recebe um valor que indica se uma propriedade deve ser localizada.
public:
property bool IsLocalizable { bool get(); };
public bool IsLocalizable { get; }
member this.IsLocalizable : bool
Public ReadOnly Property IsLocalizable As Boolean
Valor de Propriedade
true se uma propriedade deve ser localizada; caso contrário, false.
Exemplos
O exemplo seguinte mostra como verificar o valor do LocalizableAttribute para MyProperty. Primeiro, o código recebe a PropertyDescriptorCollection com todas as propriedades do objeto. Depois, o código obtém-se MyProperty do PropertyDescriptorCollection. De seguida, devolve os atributos desta propriedade e guarda-os na variável de atributos.
Finalmente, o código define myAttribute para o valor de em LocalizableAttribute e AttributeCollection verifica se a propriedade precisa de ser localizada.
// 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