LocalizableAttribute.IsLocalizable Eigenschap
Definitie
Belangrijk
Bepaalde informatie heeft betrekking op een voorlopige productversie die aanzienlijk kan worden gewijzigd voordat deze wordt uitgebracht. Microsoft biedt geen enkele expliciete of impliciete garanties met betrekking tot de informatie die hier wordt verstrekt.
Hiermee wordt een waarde opgehaald die aangeeft of een eigenschap moet worden gelokaliseerd.
public:
property bool IsLocalizable { bool get(); };
public bool IsLocalizable { get; }
member this.IsLocalizable : bool
Public ReadOnly Property IsLocalizable As Boolean
Waarde van eigenschap
true als een eigenschap moet worden gelokaliseerd; anders, false.
Voorbeelden
In het volgende voorbeeld ziet u hoe u de waarde van de LocalizableAttribute for MyPropertykunt controleren. Eerst krijgt de code een PropertyDescriptorCollection met alle eigenschappen voor het object. Vervolgens wordt MyProperty de code opgehaald uit de PropertyDescriptorCollection. Vervolgens worden de kenmerken voor deze eigenschap geretourneerd en opgeslagen in de kenmerkvariabele.
Ten slotte wordt de code ingesteld myAttribute op de waarde van de LocalizableAttribute in de AttributeCollection code en wordt gecontroleerd of de eigenschap moet worden gelokaliseerd.
// 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