fork(1) download
  1. using System;
  2. using System.Collections.Generic;
  3.  
  4. public class Test
  5. {
  6. public static void Main()
  7. {
  8. string x = "";
  9. Wrapper<string> xx = x;
  10.  
  11. string[] y = new[] { "" };
  12. Wrapper<IEnumerable<string>> yy = y;
  13.  
  14. IEnumerable<string> z = new[] { "" };
  15. Wrapper<IEnumerable<string>> zz = z;
  16. }
  17. }
  18.  
  19. public sealed class Wrapper<T>
  20. {
  21. private readonly object _value;
  22. public Wrapper(T value) {
  23. this._value = value;
  24. }
  25. public static implicit operator Wrapper<T>(T val) { return new Wrapper<T>(val); }
  26. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cs(15,37): error CS0029: Cannot implicitly convert type `System.Collections.Generic.IEnumerable<string>' to `Wrapper<System.Collections.Generic.IEnumerable<string>>'
Compilation failed: 1 error(s), 0 warnings
stdout
Standard output is empty