Source: C # resource file and the conversion of resource name strings to each other
1. Using ResourceManager
String st = Properties.Resources.ResourceManager.GetString (tableName);
Value = Properties.Resources.ResourceManager.GetObject (FileName, Properties.Resources.Culture)
public static Bitmap Getimagebyname (String imageName)
{
System.Reflection.Assembly asm = System.Reflection.Assembly.GetExecutingAssembly ();
String resourcename = asm. GetName (). Name + ". Properties.resources ";
var rm = new System.Resources.ResourceManager (resourcename, ASM);
Return (BITMAP) rm. GetObject (ImageName);
}
2. Use reflection
var type = typeof (Properties.resources);
var property = type. GetProperty (FileName, bindingflags.static| bindingflags.nonpublic| BindingFlags.Public);
var value = property. GetValue (null, NULL);
C # resource file and conversion to resource name string