BamlLocalizer.ExtractResources Metodo
Definizione
Importante
Alcune informazioni sono relative alla release non definitiva del prodotto, che potrebbe subire modifiche significative prima della release definitiva. Microsoft non riconosce alcuna garanzia, espressa o implicita, in merito alle informazioni qui fornite.
Estrae tutte le risorse localizzabili da un flusso 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
Restituisce
Una copia delle risorse localizzabili da un flusso BAML nel formato BamlLocalizationDictionary.
Esempio
Nell'esempio di codice riportato di seguito viene illustrato come utilizzare il metodo 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