fork(1) download
  1. using System;
  2. using System.Linq;
  3.  
  4. public class Test
  5. {
  6. public static void Main()
  7. {
  8. var values = Enum.GetValues(typeof(VehicleData))
  9. .Cast<string>()
  10. .Select(x => x.ToString())
  11. .ToArray();
  12. foreach(var val in values)
  13. Console.WriteLine(val);
  14. }
  15. }
  16.  
  17. public enum VehicleData
  18. {
  19. Dodge = 15001,
  20. BMW = 15002,
  21. Toyota = 15003
  22. }
Runtime error #stdin #stdout #stderr 0.01s 136064KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
Unhandled Exception:
System.InvalidCastException: Specified cast is not valid.
  at (wrapper castclass) System.Object:__castclass_with_cache (object,intptr,intptr)
  at System.Linq.Enumerable+<CastIterator>c__Iterator17`1[TResult].MoveNext () [0x00059] in <63992662b765477a898ef49cdcc99ee2>:0 
  at System.Linq.Enumerable+WhereSelectEnumerableIterator`2[TSource,TResult].MoveNext () [0x00078] in <63992662b765477a898ef49cdcc99ee2>:0 
  at System.Linq.Buffer`1[TElement]..ctor (System.Collections.Generic.IEnumerable`1[T] source) [0x00087] in <63992662b765477a898ef49cdcc99ee2>:0 
  at System.Linq.Enumerable.ToArray[TSource] (System.Collections.Generic.IEnumerable`1[T] source) [0x00011] in <63992662b765477a898ef49cdcc99ee2>:0 
  at Test.Main () [0x00036] in <6f978c00675e437883a60c2ffbc471fc>:0 
[ERROR] FATAL UNHANDLED EXCEPTION: System.InvalidCastException: Specified cast is not valid.
  at (wrapper castclass) System.Object:__castclass_with_cache (object,intptr,intptr)
  at System.Linq.Enumerable+<CastIterator>c__Iterator17`1[TResult].MoveNext () [0x00059] in <63992662b765477a898ef49cdcc99ee2>:0 
  at System.Linq.Enumerable+WhereSelectEnumerableIterator`2[TSource,TResult].MoveNext () [0x00078] in <63992662b765477a898ef49cdcc99ee2>:0 
  at System.Linq.Buffer`1[TElement]..ctor (System.Collections.Generic.IEnumerable`1[T] source) [0x00087] in <63992662b765477a898ef49cdcc99ee2>:0 
  at System.Linq.Enumerable.ToArray[TSource] (System.Collections.Generic.IEnumerable`1[T] source) [0x00011] in <63992662b765477a898ef49cdcc99ee2>:0 
  at Test.Main () [0x00036] in <6f978c00675e437883a60c2ffbc471fc>:0