LocalizableAttribute.IsLocalizable Property

Definition

Gets a value indicating whether a property should be localized.

public bool IsLocalizable { get; }

Property Value

true if a property should be localized; otherwise, false.

Examples

The following example shows how to check the value of the LocalizableAttribute for MyProperty. First, the code gets a PropertyDescriptorCollection with all the properties for the object. Then, the code gets MyProperty from the PropertyDescriptorCollection. Next, it returns the attributes for this property and saves them in the attributes variable.

Finally, the code sets myAttribute to the value of the LocalizableAttribute in the AttributeCollection and checks whether the property needs to be localized.

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

Applies to

Product Versions
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1

See also