fork download
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Threading.Tasks;
  5. using System.Windows.Forms;
  6.  
  7. namespace WindowsFormsApplication3
  8. {
  9. interface IHoge<out T>
  10. {
  11. T Value { get; }
  12. }
  13.  
  14. class HogeContainer
  15. {
  16. private IList<IHoge<ValueType>> values = new List<IHoge<ValueType>>();
  17. public IList<IHoge<ValueType>> Values
  18. {
  19. get
  20. {
  21. return this.values;
  22. }
  23. set
  24. {
  25. this.values = value;
  26. }
  27. }
  28. }
  29.  
  30. class A<T> : IHoge<ValueType> where T : struct
  31. {
  32. public ValueType Value { get; set; }
  33. }
  34.  
  35. class Program
  36. {
  37. static void Main(string[] args)
  38. {
  39. var cntnr = new HogeContainer();
  40.  
  41. cntnr.Values.Add(new A<int>() { Value = 1 });
  42. cntnr.Values.Add(new A<char>() { Value = '1' });
  43. cntnr.Values.Add(new A<double>() { Value = 1.1d });
  44.  
  45. foreach (var o in cntnr.Values)
  46. {
  47. Console.WriteLine(o.Value);
  48. }
  49.  
  50. return;
  51. }
  52. }
  53. }
  54.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.c:1: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘System’
prog.c:2: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘System’
prog.c:3: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘System’
prog.c:4: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘System’
prog.c:5: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘System’
prog.c:7: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘WindowsFormsApplication3’
prog.c:43:56: error: invalid suffix "d" on floating constant
stdout
Standard output is empty