Thank you, @Teudimundo. I modified the snippet of that link as follows:
var asm = Assembly.GetEntryAssembly();
string resName = asm.GetName().Name + ".g.resources";
using (var stream = asm.GetManifestResourceStream(resName))
using (var reader = new System.Resources.ResourceReader(stream))
{
var paths = from entry in reader.Cast<DictionaryEntry>()
where ((string)entry.Key).Contains("sub-folder-name")
select entry.Key;
if (paths.Any())
{
foreach (string path in paths)
{
Uri uri = new Uri(String.Format(
"pack://application:,,,/{0};component{1}", asm.GetName(), path)
, UriKind.Absolute);
//use the uri for the rest
}
}
}
But I still want to use the resource stream directly (can be retrieved via select entry.Value
in the LINQ expression above), which is an instance of UnmanagedMemoryStream
. I need MemoryStream
to construct my object but I found no elegant methods for conversion.