Snippet per recuperare una stringa da un file di risorse esterno:

//Namespace reference
using System;
using System.Resources;
#region ReadResourceFile

/// method for reading a value from a resource file
/// (.resx file)
/// file to read from
/// key to get the value for
/// a string value
public string ReadResourceValue(string file, string key)
    //value for our return value
    string resourceValue = string.Empty;
        // specify your resource file name
        string resourceFile = file;
        // get the path of your file
        string filePath = System.AppDomain.CurrentDomain.BaseDirectory.ToString();
        // create a resource manager for reading from
        //the resx file
        ResourceManager resourceManager = ResourceManager.CreateFileBasedResourceManager(resourceFile, filePath, null);
        // retrieve the value of the specified key
        resourceValue = resourceManager.GetString(key);
    catch (Exception ex)
        resourceValue = string.Empty;
    return resourceValue;

Per approfondire :


Secured By miniOrange