BamlLocalizableResource 类

定义

表示 BAML 流中的可本地化资源。

public ref class BamlLocalizableResource
public class BamlLocalizableResource
type BamlLocalizableResource = class
Public Class BamlLocalizableResource
继承
BamlLocalizableResource

示例

下面的示例展示了如何使用 BamlLocalizableResource


// Obtain the BAML stream.
Stream source = entry.Value as Stream;

// Create a BamlLocalizer on the stream.
BamlLocalizer localizer = new BamlLocalizer(source);
BamlLocalizationDictionary resources = localizer.ExtractResources();

// Write out all the localizable resources in the BAML.
foreach (DictionaryEntry resourceEntry in resources)
{
    BamlLocalizableResourceKey key = resourceEntry.Key as BamlLocalizableResourceKey;
    BamlLocalizableResource value = resourceEntry.Value as BamlLocalizableResource;
    Console.WriteLine(
        "    {0}.{1}.{2} = {3}",
        key.Uid,
        key.ClassName,
        key.PropertyName,
        value.Content
        );                                
}

' Obtain the BAML stream.
Dim source As Stream = TryCast(entry.Value, Stream)

' Create a BamlLocalizer on the stream.
Dim localizer As New BamlLocalizer(source)
Dim resources As BamlLocalizationDictionary = localizer.ExtractResources()

' Write out all the localizable resources in the BAML.
For Each resourceEntry As DictionaryEntry In resources
    Dim key As BamlLocalizableResourceKey = TryCast(resourceEntry.Key, BamlLocalizableResourceKey)
    Dim value As BamlLocalizableResource = TryCast(resourceEntry.Value, BamlLocalizableResource)
    Console.WriteLine("    {0}.{1}.{2} = {3}", key.Uid, key.ClassName, key.PropertyName, value.Content)
Next resourceEntry

注解

BamlLocalizableResource 是键值对的值组件,位于一个 BamlLocalizationDictionary

构造函数

BamlLocalizableResource()

初始化 BamlLocalizableResource 类的新实例。

BamlLocalizableResource(String, String, LocalizationCategory, Boolean, Boolean)

使用指定的可本地化值、本地化注释、资源类别、本地化锁状态及资源的可见性来初始化 BamlLocalizableResource 类的新实例。

属性

Category

获取或设置资源的本地化类别。

Comments

获取或设置与资源关联的本地化注释。

Content

获取或设置可本地化的内容。

Modifiable

获取或设置一个值,该值指示是否可修改可本地化的资源。

Readable

获取或设置资源在翻译时是否可见。

方法

Equals(Object)

确定指定的 BamlLocalizableResource 对象是否等于此对象。

GetHashCode()

返回表示此实例的整数哈希代码。

GetType()

获取当前实例的 Type

(继承自 Object)
MemberwiseClone()

创建当前 Object 的浅表副本。

(继承自 Object)
ToString()

返回表示当前对象的字符串。

(继承自 Object)

适用于

另请参阅