Add support for generics (#20)

* wip

* .

* method

* TT

* TT

* .

* .

* mp
This commit is contained in:
Stef Heyenrath
2021-08-01 10:34:25 +02:00
committed by GitHub
parent 296988b13f
commit 390093d007
18 changed files with 322 additions and 169 deletions
+13 -27
View File
@@ -14,45 +14,31 @@ namespace ProxyInterfaceConsumer
public static void Main()
{
var c = new Clazz
{
Name = "n"
};
var cp = new ClazzProxy(c);
var t = new Test();
t.Cs = new List<Clazz> { c };
var tp = new TestProxy(t);
tp.Cs = new List<IClazz> { cp };
Console.WriteLine(JsonSerializer.Serialize(t, JsonSerializerOptions));
IPersonT<int> pT = new PersonTProxy<int>(new PersonT<int>());
pT.TVal = 1;
Console.WriteLine(JsonSerializer.Serialize(pT, JsonSerializerOptions));
Console.WriteLine(new string('-', 80));
IPersonTT<int, Program> pTT = new PersonTTProxy<int, Program>(new PersonTT<int, Program>());
pTT.TVal1 = 42;
pTT.TVal2 = new Program();
Console.WriteLine(JsonSerializer.Serialize(pTT, JsonSerializerOptions));
Console.WriteLine(new string('-', 80));
IPerson p = new PersonProxy(new Person());
p.Name = "test";
Console.WriteLine("DefaultValue " + p.DefaultValue());
Console.WriteLine("DefaultValue " + p.DefaultValue(42));
var ap = new AddressProxy(new Address { HouseNumber = 42 });
p.Address = ap;
var add = p.AddAddress(ap);
Console.WriteLine("add = " + JsonSerializer.Serialize(add, JsonSerializerOptions));
p.AddAddress(new AddressProxy(new Address { HouseNumber = 1000 }));
//var ap = new AddressProxy(new Address { HouseNumber = 42 });
//p.Address = ap;
//var add = p.AddAddress(ap);
//Console.WriteLine("add = " + JsonSerializer.Serialize(add, JsonSerializerOptions));
//p.AddAddress(new AddressProxy(new Address { HouseNumber = 1000 }));
//p.MyNamedTypeSymbol = null;
//p.Compilation = null;
//p.Add("x");
//p.Void();
Console.WriteLine(JsonSerializer.Serialize(p, JsonSerializerOptions));
//GeneratorExecutionContext g = new GeneratorExecutionContext();
//IGeneratorExecutionContext gc = new GeneratorExecutionContextProxy(g);
//int y = 9;
}
}
public struct Test
{
public int Id { get; set; }