fork(1) download
  1. using System;
  2. using System.Linq;
  3. using System.Globalization;
  4.  
  5. public class Test
  6. {
  7. public static CultureInfo getCultureByEnglishName(String englishName)
  8. {
  9. //create an array of CultureInfo to hold all the cultures found, these include the users local cluture, and all the
  10. //cultures installed with the .Net Framework
  11. CultureInfo[] cultures = CultureInfo.GetCultures(CultureTypes.AllCultures & ~CultureTypes.NeutralCultures);
  12. // get culture by it's english name
  13. var culture = cultures.FirstOrDefault(c => c.EnglishName.ToLower() == englishName.ToLower());
  14. return culture;
  15. }
  16.  
  17. public static void Main()
  18. {
  19. String name = "English";
  20. CultureInfo englCulture = getCultureByEnglishName(name);
  21. Console.Write(DateTime.Now.ToString("dddd",englCulture));
  22. }
  23. }
Success #stdin #stdout 0.04s 37200KB
stdin
Standard input is empty
stdout
Monday