BamlLocalizer.ExtractResources Méthode
Définition
Important
Certaines informations portent sur la préversion du produit qui est susceptible d’être en grande partie modifiée avant sa publication. Microsoft exclut toute garantie, expresse ou implicite, concernant les informations fournies ici.
Extrait toutes les ressources localisables d'un flux 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
Retours
Copie des ressources localisables d'un flux BAML sous la forme de BamlLocalizationDictionary.
Exemples
L'exemple de code suivant illustre l'utilisation de la méthode 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