BamlLocalizationDictionary Class

Definition

Contains all the localizable resources in a BAML record.

public sealed class BamlLocalizationDictionary : System.Collections.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
        );                                
}

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

Produit Versions
.NET Framework 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
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9

See also