using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace WindowsFormsApplication3
{
interface IHoge<out T>
{
T Value { get; }
}
class HogeContainer
{
private IList<IHoge<ValueType>> values = new List<IHoge<ValueType>>();
public IList<IHoge<ValueType>> Values
{
get
{
return this.values;
}
set
{
this.values = value;
}
}
}
class A<T> : IHoge<ValueType> where T : struct
{
public ValueType Value { get; set; }
}
class Program
{
static void Main(string[] args)
{
var cntnr = new HogeContainer();
cntnr.Values.Add(new A<int>() { Value = 1 });
cntnr.Values.Add(new A<char>() { Value = '1' });
cntnr.Values.Add(new A<double>() { Value = 1.1d });
foreach (var o in cntnr.Values)
{
Console.WriteLine(o.Value);
}
return;
}
}
}
dXNpbmcgU3lzdGVtOwp1c2luZyBTeXN0ZW0uQ29sbGVjdGlvbnMuR2VuZXJpYzsKdXNpbmcgU3lzdGVtLkxpbnE7CnVzaW5nIFN5c3RlbS5UaHJlYWRpbmcuVGFza3M7CnVzaW5nIFN5c3RlbS5XaW5kb3dzLkZvcm1zOwoKbmFtZXNwYWNlIFdpbmRvd3NGb3Jtc0FwcGxpY2F0aW9uMwp7CiAgICBpbnRlcmZhY2UgSUhvZ2U8b3V0IFQ+CiAgICB7CiAgICAgICAgVCBWYWx1ZSB7IGdldDsgfQogICAgfQoKICAgIGNsYXNzIEhvZ2VDb250YWluZXIKICAgIHsKICAgICAgICBwcml2YXRlIElMaXN0PElIb2dlPFZhbHVlVHlwZT4+IHZhbHVlcyA9IG5ldyBMaXN0PElIb2dlPFZhbHVlVHlwZT4+KCk7CiAgICAgICAgcHVibGljIElMaXN0PElIb2dlPFZhbHVlVHlwZT4+IFZhbHVlcwogICAgICAgIHsKICAgICAgICAgICAgZ2V0CiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLnZhbHVlczsKICAgICAgICAgICAgfQogICAgICAgICAgICBzZXQKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgdGhpcy52YWx1ZXMgPSB2YWx1ZTsKICAgICAgICAgICAgfQogICAgICAgIH0KICAgIH0KCiAgICBjbGFzcyBBPFQ+IDogSUhvZ2U8VmFsdWVUeXBlPiB3aGVyZSBUIDogc3RydWN0CiAgICB7CiAgICAgICAgcHVibGljIFZhbHVlVHlwZSBWYWx1ZSB7IGdldDsgc2V0OyB9CiAgICB9CgogICAgY2xhc3MgUHJvZ3JhbQogICAgewogICAgICAgIHN0YXRpYyB2b2lkIE1haW4oc3RyaW5nW10gYXJncykKICAgICAgICB7CiAgICAgICAgICAgIHZhciBjbnRuciA9IG5ldyBIb2dlQ29udGFpbmVyKCk7CgogICAgICAgICAgICBjbnRuci5WYWx1ZXMuQWRkKG5ldyBBPGludD4oKSB7IFZhbHVlID0gMSB9KTsKICAgICAgICAgICAgY250bnIuVmFsdWVzLkFkZChuZXcgQTxjaGFyPigpIHsgVmFsdWUgPSAnMScgfSk7CiAgICAgICAgICAgIGNudG5yLlZhbHVlcy5BZGQobmV3IEE8ZG91YmxlPigpIHsgVmFsdWUgPSAxLjFkIH0pOwoKICAgICAgICAgICAgZm9yZWFjaCAodmFyIG8gaW4gY250bnIuVmFsdWVzKQogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICBDb25zb2xlLldyaXRlTGluZShvLlZhbHVlKTsKICAgICAgICAgICAgfQoKICAgICAgICAgICAgcmV0dXJuOwogICAgICAgIH0KICAgIH0KfQo=
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