简体   繁体   中英

Retrieve Name From Resource File (RESX) in C#

How to retrieve name and value from Resource file in C# ( RESX )? For example if I have Resource file with name "MimeTypes" and if I want to to retrieve name jpeg and the return value to be image/jpeg .

You can use ResxResourceReader .

using (var resourceReader = new ResxResourceReader("foo.resx"))
{
    foreach (DictionaryEntry resource in resourceReader)
    { 
        string key = resource.Key.ToString(); 
        string value = resource.Value.ToString();
    }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM