編集

次の方法で共有


BamlLocalizationDictionary Class

Definition

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
type BamlLocalizationDictionary = class
    interface ICollection
    interface IEnumerable
    interface IDictionary
Public NotInheritable Class BamlLocalizationDictionary
Implements IDictionary
Inheritance
BamlLocalizationDictionary
Implements

Examples

The 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

Remarks

The dictionary contains a mapping from resource keys (specified as BamlLocalizableResourceKey objects) to resource values (specified as BamlLocalizableResource objects).

Constructors

BamlLocalizationDictionary()

Initializes a new instance of the BamlLocalizationDictionary class.

Properties

Count

Gets the number of localizable resources in the BamlLocalizationDictionary.

IsFixedSize

Gets a value that indicates whether the BamlLocalizationDictionary object has a fixed size.

IsReadOnly

Gets a value that indicates whether the BamlLocalizationDictionary object is read-only.

Item[BamlLocalizableResourceKey]

Gets or sets a localizable resource specified by its key.

Keys

Gets a collection that contains all the keys in the BamlLocalizationDictionary object.

RootElementKey

Gets the key of the root element, if it is localizable.

Values

Gets a collection that contains all the values in the BamlLocalizationDictionary.

Methods

Add(BamlLocalizableResourceKey, BamlLocalizableResource)

Adds an item with the provided key and value to the BamlLocalizationDictionary.

Clear()

Deletes all resources from the BamlLocalizationDictionary object.

Contains(BamlLocalizableResourceKey)

Determines whether a BamlLocalizationDictionary object contains a resource with a specified key.

CopyTo(DictionaryEntry[], Int32)

Copies the contents of a BamlLocalizationDictionary object to a one-dimensional array of DictionaryEntry objects, starting at a specified index.

Equals(Object)

Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetEnumerator()

Returns an enumerator that iterates through the BamlLocalizationDictionary.

GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetType()

Gets the Type of the current instance.

(Inherited from Object)
MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
Remove(BamlLocalizableResourceKey)

Removes a specified localizable resource from the BamlLocalizationDictionary.

ToString()

Returns a string that represents the current object.

(Inherited from Object)

Explicit Interface Implementations

ICollection.CopyTo(Array, Int32)

For a description of this member, see CopyTo(Array, Int32).

ICollection.Count

For a description of this member, see Count.

ICollection.IsSynchronized

For a description of this member, see IsSynchronized.

ICollection.SyncRoot

For a description of this member, see SyncRoot.

IDictionary.Add(Object, Object)

For a description of this member, see Add(Object, Object).

IDictionary.Contains(Object)

For a description of this member, see Contains(Object).

IDictionary.GetEnumerator()

For a description of this member, see GetEnumerator().

IDictionary.Item[Object]

For a description of this member, see Item[Object].

IDictionary.Remove(Object)

For a description of this member, see Remove(Object).

IEnumerable.GetEnumerator()

For a description of this member, see GetEnumerator().

Extension Methods

Cast<TResult>(IEnumerable)

Casts the elements of an IEnumerable to the specified type.

OfType<TResult>(IEnumerable)

Filters the elements of an IEnumerable based on a specified type.

AsParallel(IEnumerable)

Enables parallelization of a query.

AsQueryable(IEnumerable)

Converts an IEnumerable to an IQueryable.

Applies to

See also