fork download
  1. internal static class Extensions
  2. {
  3. internal static string GetEnumerated<T>(IEnumerable<T> items)
  4. {
  5. var sb = new StringBuilder();
  6. using (var enumerator = items.GetEnumerator())
  7. {
  8. if (!enumerator.MoveNext())
  9. {
  10. return String.Empty;
  11. }
  12.  
  13. string previous = enumerator.Current.ToString();
  14. if (!enumerator.MoveNext())
  15. {
  16. return previous;
  17. }
  18.  
  19. do
  20. {
  21. string current = enumerator.Current.ToString();
  22. sb.Append(previous);
  23. sb.Append(", ");
  24.  
  25. previous = current;
  26. }
  27. while (enumerator.MoveNext());
  28.  
  29. sb.Append(", and ");
  30. sb.Append(previous);
  31. }
  32.  
  33. return sb.ToString();
  34. }
  35. }
  36.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cs(3,42): error CS0246: The type or namespace name `IEnumerable' could not be found. Are you missing `System.Collections.Generic' using directive?
Compilation failed: 1 error(s), 0 warnings
stdout
Standard output is empty