BamlLocalizer.ExtractResources Method ()

 

Extracts all localizable resources from a BAML stream.

Namespace:   System.Windows.Markup.Localizer
Assembly:  PresentationFramework (in PresentationFramework.dll)

public BamlLocalizationDictionary ExtractResources()

Return Value

Type: System.Windows.Markup.Localizer.BamlLocalizationDictionary

A copy of the localizable resources from a BAML stream, in the form of a BamlLocalizationDictionary.

The following code example demonstrates how to use the ExtractResources method.


// 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
        );                                
}

.NET Framework
Available since 3.0
Return to top
Show: