How does RESX work?

RESX (Resource XML) files are XML-based resource files used in .NET applications to store localized strings, images, and other assets. Each entry in a RESX file is a <data> element containing a name attribute (the key) and a <value> child node (the resource) — for example:

<?xml version="1.0" encoding="utf-8"?>
<root>
  <resheader name="resmimetype">
    <value>text/microsoft-resx</value>
  </resheader>
  <resheader name="version">
    <value>2.0</value>
  </resheader>
  <resheader name="reader">
    <value>System.Resources.ResXResourceReader, System.Windows.Forms</value>
  </resheader>
  <resheader name="writer">
    <value>System.Resources.ResXResourceWriter, System.Windows.Forms</value>
  </resheader>

  <data name="WelcomeMessage" xml:space="preserve">
    <value>Welcome to our app</value>
  </data>
  <data name="LogoutButton" xml:space="preserve">
    <value>Log Out</value>
  </data>
  <data name="ItemsInCart" xml:space="preserve">
    <value>You have {0} items in your cart.</value>
  </data>
</root>

Developers can also work with RESX programmatically using the .NET System.Resources APIs. For instance, using ResXResourceWriter to generate a .resx file:

using (var resx = new ResXResourceWriter("Resources.resx"))
{
    resx.AddResource("Greeting", "Hello");
    resx.AddResource("Farewell", "Goodbye");
}

And to read from a RESX file:

using (var reader = new ResXResourceReader("Resources.resx"))
{
    foreach (System.Collections.DictionaryEntry entry in reader)
    {
        Console.WriteLine($"{entry.Key}: {entry.Value}");
    }
}

In development, RESX files let you separate UI content from code, so you can support multiple languages without rewriting your application. For each target language, you create a separate RESX file (for example, Resources.en.resx, Resources.de.resx, etc.), and the .NET runtime automatically loads the right file based on the user’s culture settings.

For translation, this means you can hand off the language-specific RESX files to translators, who only need to work with the values while developers keep the structure and keys intact.

Was this article helpful?

Please help us with improving our documentation.
We appreciate all your feedback.

Category

Last updated

25/09/2025