private IDictionary <string, string> getAllCurrenciesShortcuts() { IDictionary <string, string> returnedCurrencies = new Dictionary <string, string>(); Properties.Resources resources = new Properties.Resources(); Type resourcesType = resources.GetType(); var props = resourcesType.GetProperties(); foreach (var prop in props) { if (prop.Name.ToLower().Contains("currencyshortcut") && prop.Name.Length > "currencyshortcut".Length + 1) { returnedCurrencies.Add(prop.Name, prop.GetValue(resources).ToString()); } } return(returnedCurrencies); }
public string Translate(string source) { if (source == null) { return(null); } Properties.Resources resources = new Properties.Resources(); Type resourcesType = resources.GetType(); var props = resourcesType.GetProperties(); foreach (var prop in props) { if (prop.Name.ToLower() == source.ToLower()) { return(prop.GetValue(resources).ToString()); } } return(null); }