中文 | English
CI Platform | Build Server | Master Build | Master Test |
---|---|---|---|
Travis | Linux/OSX | ||
AppVeyor | Windows/Linux | ||
Azure | Windows | ||
Azure | Linux | ||
Azure | Mac |
此项目为Natasha的衍生项目,通过运行时自动构建高性能操作代理类,为普通类,静态类,动态类,动态类中的动态类,动态生成的静态类等提供了良好的、完备的、高性能的操作,如果反射、dynamic都不能满足高端的需求,可使用本类库,它将是一个不错的选择。
- 2019-08-01 : 发布v1.0.0.0, 高性能动态调用库。
由于benchmark 不能支持最新的roslyn编译测试,因此基准测试放在3.0版本后。
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.2</TargetFramework>
<PreserveCompilationContext>true</PreserveCompilationContext> <--- 一定要加上这句话
</PropertyGroup>
public class A
{
public int Age;
public DateTime Time;
public B Outter = new B();
}
public class B
{
public string Name;
public B()
{
Name = "小明"
}
}
//调用方式(支持动态类型)
var handler = DynamicCaller.Create(typeof(A));
handler.New();
handler["Age"].Set(100); // Set Operator
handler.Set("Age", 100); // Set Operator
Console.WriteLine(handler["Time"].Get<DateTime>()); // Get Operator
Console.WriteLine(handler.Get<DateTime>("Time")); // Get Operator
handler.Get("Outter")["Name"].Set("NewName"); // Link Operator
handler.Get<B>("Outter").Name = "NewName"; // Link Operator
public static class A
{
public static int Age;
public static DateTime Time;
public static B Outter = new B();
}
public class B
{
public string Name;
public B()
{
Name = "小明";
}
}
//调用方式(支持动态类型)
var handler = StaticDynamicCaller.Create(type(A));
handler["Age"].Set(100); // Set Operator
handler.Set("Age", 100); // Set Operator
Console.WriteLine(handler["Time"].Get<DateTime>()); // Get Operator
Console.WriteLine(handler.Get<DateTime>("Time")); // Get Operator
handler.Get("Outter").Set(Name,"NewName"); // Link Operator
handler.Get<B>("Outter").Name = "NewName"; // Link Operator