LocalizableAttribute.IsLocalizable Tulajdonság
Definíció
Fontos
Egyes információk olyan, kiadás előtti termékekre vonatkoznak, amelyek a kiadásig még jelentősen módosulhatnak. A Microsoft nem vállal kifejezett vagy törvényi garanciát az itt megjelenő információért.
Egy tulajdonság honosítását jelző értéket kap.
public:
property bool IsLocalizable { bool get(); };
public bool IsLocalizable { get; }
member this.IsLocalizable : bool
Public ReadOnly Property IsLocalizable As Boolean
Tulajdonság értéke
trueha egy tulajdonság honosítandó; egyéb esetben. false
Példák
Az alábbi példa bemutatja, hogyan ellenőrizheti a for LocalizableAttributeértékétMyProperty. Először is a kód lekéri PropertyDescriptorCollection az objektum összes tulajdonságát. Ezután a kód a MyPropertyPropertyDescriptorCollection. Ezután visszaadja a tulajdonság attribútumait, és menti őket az attribútumváltozóba.
Végül a kód a benne lévő myAttribute értékre LocalizableAttribute állítja AttributeCollection be a kódot, és ellenőrzi, hogy a tulajdonságot lokalizálni kell-e.
// 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