BamlLocalizationDictionary BamlLocalizationDictionary BamlLocalizationDictionary BamlLocalizationDictionary Class

定義

將所有可當地語系化的資源包含在 BAML 記錄中。Contains all the localizable resources in a BAML record.

public ref class BamlLocalizationDictionary sealed : System::Collections::IDictionary
public sealed class BamlLocalizationDictionary : System.Collections.IDictionary
type BamlLocalizationDictionary = class
    interface IDictionary
    interface ICollection
    interface IEnumerable
Public NotInheritable Class BamlLocalizationDictionary
Implements IDictionary
繼承
BamlLocalizationDictionaryBamlLocalizationDictionaryBamlLocalizationDictionaryBamlLocalizationDictionary
實作

範例

下列範例示範如何使用 BamlLocalizationDictionaryThe following example demonstrates how to use a BamlLocalizationDictionary.


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

備註

字典包含資源索引鍵的對應 (指定為BamlLocalizableResourceKey物件) 資源的值 (指定為BamlLocalizableResource物件)。The dictionary contains a mapping from resource keys (specified as BamlLocalizableResourceKey objects) to resource values (specified as BamlLocalizableResource objects).

建構函式

BamlLocalizationDictionary() BamlLocalizationDictionary() BamlLocalizationDictionary() BamlLocalizationDictionary()

初始化 BamlLocalizationDictionary 類別的新執行個體。Initializes a new instance of the BamlLocalizationDictionary class.

屬性

Count Count Count Count

取得 BamlLocalizationDictionary 中可當地語系化資源的數目。Gets the number of localizable resources in the BamlLocalizationDictionary.

IsFixedSize IsFixedSize IsFixedSize IsFixedSize

取得值,指出 BamlLocalizationDictionary 物件是否有固定的大小。Gets a value that indicates whether the BamlLocalizationDictionary object has a fixed size.

IsReadOnly IsReadOnly IsReadOnly IsReadOnly

取得值,這個值表示 BamlLocalizationDictionary 物件是否為唯讀。Gets a value that indicates whether the BamlLocalizationDictionary object is read-only.

Item[BamlLocalizableResourceKey] Item[BamlLocalizableResourceKey] Item[BamlLocalizableResourceKey] Item[BamlLocalizableResourceKey]

取得或設定由其索引鍵指定之可當地語系化的資源。Gets or sets a localizable resource specified by its key.

Keys Keys Keys Keys

取得集合,其中包含 BamlLocalizationDictionary 物件中的所有索引鍵。Gets a collection that contains all the keys in the BamlLocalizationDictionary object.

RootElementKey RootElementKey RootElementKey RootElementKey

取得根項目 (Root Element) 的索引鍵 (如果該項目可當地語系化的話)。Gets the key of the root element, if it is localizable.

Values Values Values Values

取得集合,其中包含 BamlLocalizationDictionary 中的所有值。Gets a collection that contains all the values in the BamlLocalizationDictionary.

方法

Add(BamlLocalizableResourceKey, BamlLocalizableResource) Add(BamlLocalizableResourceKey, BamlLocalizableResource) Add(BamlLocalizableResourceKey, BamlLocalizableResource) Add(BamlLocalizableResourceKey, BamlLocalizableResource)

將具有所提供之索引鍵和值的項目加入至 BamlLocalizationDictionaryAdds an item with the provided key and value to the BamlLocalizationDictionary.

Clear() Clear() Clear() Clear()

BamlLocalizationDictionary 物件刪除所有資源。Deletes all resources from the BamlLocalizationDictionary object.

Contains(BamlLocalizableResourceKey) Contains(BamlLocalizableResourceKey) Contains(BamlLocalizableResourceKey) Contains(BamlLocalizableResourceKey)

判斷 BamlLocalizationDictionary 物件是否包含具有指定索引鍵的資源。Determines whether a BamlLocalizationDictionary object contains a resource with a specified key.

CopyTo(DictionaryEntry[], Int32) CopyTo(DictionaryEntry[], Int32) CopyTo(DictionaryEntry[], Int32) CopyTo(DictionaryEntry[], Int32)

BamlLocalizationDictionary 物件的內容複製至 DictionaryEntry 物件的一維陣列,從指定的索引處開始複製。Copies the contents of a BamlLocalizationDictionary object to a one-dimensional array of DictionaryEntry objects, starting at a specified index.

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

判斷指定的物件是否等於目前的物件。Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetEnumerator() GetEnumerator() GetEnumerator() GetEnumerator()

傳回在 BamlLocalizationDictionary 中逐一查看的列舉值。Returns an enumerator that iterates through the BamlLocalizationDictionary.

GetHashCode() GetHashCode() GetHashCode() GetHashCode()

做為預設雜湊函式。Serves as the default hash function.

(Inherited from Object)
GetType() GetType() GetType() GetType()

取得目前執行個體的 TypeGets the Type of the current instance.

(Inherited from Object)
MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

建立目前 Object 的淺層複本 (Shallow Copy)。Creates a shallow copy of the current Object.

(Inherited from Object)
Remove(BamlLocalizableResourceKey) Remove(BamlLocalizableResourceKey) Remove(BamlLocalizableResourceKey) Remove(BamlLocalizableResourceKey)

BamlLocalizationDictionary 移除指定之可當地語系化的資源。Removes a specified localizable resource from the BamlLocalizationDictionary.

ToString() ToString() ToString() ToString()

傳回代表目前物件的字串。Returns a string that represents the current object.

(Inherited from Object)

明確介面實作

ICollection.CopyTo(Array, Int32) ICollection.CopyTo(Array, Int32) ICollection.CopyTo(Array, Int32) ICollection.CopyTo(Array, Int32)

如需這個成員的說明,請參閱 CopyTo(Array, Int32)For a description of this member, see CopyTo(Array, Int32).

ICollection.Count ICollection.Count ICollection.Count ICollection.Count

如需這個成員的說明,請參閱 CountFor a description of this member, see Count.

ICollection.IsSynchronized ICollection.IsSynchronized ICollection.IsSynchronized ICollection.IsSynchronized

如需這個成員的說明,請參閱 IsSynchronizedFor a description of this member, see IsSynchronized.

ICollection.SyncRoot ICollection.SyncRoot ICollection.SyncRoot ICollection.SyncRoot

如需這個成員的說明,請參閱 SyncRootFor a description of this member, see SyncRoot.

IDictionary.Add(Object, Object) IDictionary.Add(Object, Object) IDictionary.Add(Object, Object) IDictionary.Add(Object, Object)

如需這個成員的說明,請參閱 Add(Object, Object)For a description of this member, see Add(Object, Object).

IDictionary.Contains(Object) IDictionary.Contains(Object) IDictionary.Contains(Object) IDictionary.Contains(Object)

如需這個成員的說明,請參閱 Contains(Object)For a description of this member, see Contains(Object).

IDictionary.GetEnumerator() IDictionary.GetEnumerator() IDictionary.GetEnumerator() IDictionary.GetEnumerator()

如需這個成員的說明,請參閱 GetEnumerator()For a description of this member, see GetEnumerator().

IDictionary.Item[Object] IDictionary.Item[Object] IDictionary.Item[Object] IDictionary.Item[Object]

如需這個成員的說明,請參閱 Item[Object]For a description of this member, see Item[Object].

IDictionary.Remove(Object) IDictionary.Remove(Object) IDictionary.Remove(Object) IDictionary.Remove(Object)

如需這個成員的說明,請參閱 Remove(Object)For a description of this member, see Remove(Object).

IEnumerable.GetEnumerator() IEnumerable.GetEnumerator() IEnumerable.GetEnumerator() IEnumerable.GetEnumerator()

如需這個成員的說明,請參閱 GetEnumerator()For a description of this member, see GetEnumerator().

Extension Methods

Cast<TResult>(IEnumerable) Cast<TResult>(IEnumerable) Cast<TResult>(IEnumerable) Cast<TResult>(IEnumerable)

IEnumerable 的項目轉換成指定的型別。Casts the elements of an IEnumerable to the specified type.

OfType<TResult>(IEnumerable) OfType<TResult>(IEnumerable) OfType<TResult>(IEnumerable) OfType<TResult>(IEnumerable)

根據指定的型別來篩選 IEnumerable 的項目。Filters the elements of an IEnumerable based on a specified type.

AsParallel(IEnumerable) AsParallel(IEnumerable) AsParallel(IEnumerable) AsParallel(IEnumerable)

啟用查詢的平行化作業。Enables parallelization of a query.

AsQueryable(IEnumerable) AsQueryable(IEnumerable) AsQueryable(IEnumerable) AsQueryable(IEnumerable)

將轉換IEnumerableIQueryableConverts an IEnumerable to an IQueryable.

適用於

另請參閱