BamlLocalizer.ExtractResources Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Extracts all localizable resources from a BAML stream.
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
Returns
A copy of the localizable resources from a BAML stream, in the form of a BamlLocalizationDictionary.
Examples
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
);
}
' 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
Applies to
See also
GitHub에서 Microsoft와 공동 작업
이 콘텐츠의 원본은 GitHub에서 찾을 수 있으며, 여기서 문제와 끌어오기 요청을 만들고 검토할 수도 있습니다. 자세한 내용은 참여자 가이드를 참조하세요.
.NET