LocalizableAttribute.IsLocalizable 속성

정의

속성을 지역화해야 하는지 여부를 나타내는 값을 가져옵니다.

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

속성 값

속성을 지역화해야 하는 경우 true이고, 그렇지 않은 경우 false입니다.

예제

다음 예제에서는 의 값을 LocalizableAttributeMyProperty검사 방법을 보여줍니다. 먼저 코드는 개체에 대한 모든 속성을 가진 을 가져옵니다 PropertyDescriptorCollection . 그런 다음 코드는 에서 가져옵니다 MyPropertyPropertyDescriptorCollection. 다음으로 이 속성의 특성을 반환하고 특성 변수에 저장합니다.

마지막으로 코드는 의 값을 LocalizableAttributeAttributeCollection 로 설정하고 myAttribute 속성을 지역화해야 하는지 여부를 확인합니다.

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

적용 대상

추가 정보