fork download
  1. using System;
  2. using System.Resources;
  3. using System.Reflection;
  4.  
  5. public class Program {
  6. public static void Main() {
  7. var area = SystemArea.Gestor;
  8. Console.WriteLine(area.Display());
  9. }
  10. }
  11.  
  12. public static class SystemAreaExtension {
  13. public static string Display(this SystemArea value) {
  14. var compare = new ResourceManager("SystemArea", Assembly.GetExecutingAssembly())
  15. .GetString("SystemArea_" + value);
  16. return string.IsNullOrEmpty(compare) ? value.ToString() : compare;
  17. }
  18. public static string Display(this Enum value) {
  19. var compare = new ResourceManager("SystemArea", Assembly.GetExecutingAssembly())
  20. .GetString("SystemArea_" + value);
  21. return string.IsNullOrEmpty(compare) ? value.ToString() : compare;
  22. }
  23. }
  24.  
  25. public enum SystemArea {
  26. Gestor = 3,
  27. Administrador = 2,
  28. Professor = 1,
  29. Aluno = 0,
  30. }
  31.  
  32. //https://pt.stackoverflow.com/q/82946/101
Runtime error #stdin #stdout #stderr 0.02s 16816KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
Unhandled Exception:
System.Resources.MissingManifestResourceException: Could not find any resources appropriate for the specified culture or the neutral culture.  Make sure "SystemArea.resources" was correctly embedded or linked into assembly "prog" at compile time, or that all the satellite assemblies required are loadable and fully signed.
  at System.Resources.ManifestBasedResourceGroveler.HandleResourceStreamMissing (System.String fileName) [0x000bf] in <6649516e5b3542319fb262b421af0adb>:0 
  at System.Resources.ManifestBasedResourceGroveler.GrovelForResourceSet (System.Globalization.CultureInfo culture, System.Collections.Generic.Dictionary`2[TKey,TValue] localResourceSets, System.Boolean tryParents, System.Boolean createIfNotExists, System.Threading.StackCrawlMark& stackMark) [0x000d9] in <6649516e5b3542319fb262b421af0adb>:0 
  at System.Resources.ResourceManager.InternalGetResourceSet (System.Globalization.CultureInfo requestedCulture, System.Boolean createIfNotExists, System.Boolean tryParents, System.Threading.StackCrawlMark& stackMark) [0x00099] in <6649516e5b3542319fb262b421af0adb>:0 
  at System.Resources.ResourceManager.InternalGetResourceSet (System.Globalization.CultureInfo culture, System.Boolean createIfNotExists, System.Boolean tryParents) [0x00002] in <6649516e5b3542319fb262b421af0adb>:0 
  at System.Resources.ResourceManager.GetString (System.String name, System.Globalization.CultureInfo culture) [0x0005a] in <6649516e5b3542319fb262b421af0adb>:0 
  at System.Resources.ResourceManager.GetString (System.String name) [0x00000] in <6649516e5b3542319fb262b421af0adb>:0 
  at SystemAreaExtension.Display (SystemArea value) [0x0001f] in <8124a24344b34753ba1c2c026f04d77c>:0 
  at Program.Main () [0x00002] in <8124a24344b34753ba1c2c026f04d77c>:0 
[ERROR] FATAL UNHANDLED EXCEPTION: System.Resources.MissingManifestResourceException: Could not find any resources appropriate for the specified culture or the neutral culture.  Make sure "SystemArea.resources" was correctly embedded or linked into assembly "prog" at compile time, or that all the satellite assemblies required are loadable and fully signed.
  at System.Resources.ManifestBasedResourceGroveler.HandleResourceStreamMissing (System.String fileName) [0x000bf] in <6649516e5b3542319fb262b421af0adb>:0 
  at System.Resources.ManifestBasedResourceGroveler.GrovelForResourceSet (System.Globalization.CultureInfo culture, System.Collections.Generic.Dictionary`2[TKey,TValue] localResourceSets, System.Boolean tryParents, System.Boolean createIfNotExists, System.Threading.StackCrawlMark& stackMark) [0x000d9] in <6649516e5b3542319fb262b421af0adb>:0 
  at System.Resources.ResourceManager.InternalGetResourceSet (System.Globalization.CultureInfo requestedCulture, System.Boolean createIfNotExists, System.Boolean tryParents, System.Threading.StackCrawlMark& stackMark) [0x00099] in <6649516e5b3542319fb262b421af0adb>:0 
  at System.Resources.ResourceManager.InternalGetResourceSet (System.Globalization.CultureInfo culture, System.Boolean createIfNotExists, System.Boolean tryParents) [0x00002] in <6649516e5b3542319fb262b421af0adb>:0 
  at System.Resources.ResourceManager.GetString (System.String name, System.Globalization.CultureInfo culture) [0x0005a] in <6649516e5b3542319fb262b421af0adb>:0 
  at System.Resources.ResourceManager.GetString (System.String name) [0x00000] in <6649516e5b3542319fb262b421af0adb>:0 
  at SystemAreaExtension.Display (SystemArea value) [0x0001f] in <8124a24344b34753ba1c2c026f04d77c>:0 
  at Program.Main () [0x00002] in <8124a24344b34753ba1c2c026f04d77c>:0