Compartir a través de


BamlLocalizer.ExtractResources Método

Definición

Extrae todos los recursos traducibles de una secuencia BAML.

public:
 System::Windows::Markup::Localizer::BamlLocalizationDictionary ^ ExtractResources();
public System.Windows.Markup.Localizer.BamlLocalizationDictionary ExtractResources ();
member this.ExtractResources : unit -> System.Windows.Markup.Localizer.BamlLocalizationDictionary
Public Function ExtractResources () As BamlLocalizationDictionary

Devoluciones

BamlLocalizationDictionary

Copia de los recursos traducibles de una secuencia BAML, en forma de BamlLocalizationDictionary.

Ejemplos

En el ejemplo de código siguiente se muestra cómo utilizar el método ExtractResources.


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

Se aplica a

Consulte también