private static DynamicTypeInfo EmitConcreteInstanceSupport <T>( this DynamicTypeInfo that) { that .WithField("__concreteinstance", typeof(T)) .WithMethod("__SetConcreteInstance") .WithParameter(typeof(T)) .Returns(typeof(void)) .Ldarg(0) .Ldarg(1) .Stfld("__concreteinstance") .Ret(); return(that); }
private static DynamicTypeInfo EmitProxyMonitorSupport( this DynamicTypeInfo that, bool condition ) { if (!condition) { return(that); } that .WithField("__proxymonitor", typeof(IProxyMonitor)) .WithMethod("__SetProxyMonitor") .WithParameter(typeof(IProxyMonitor)) .Returns(typeof(void)) .Ldarg(0) .Ldarg(1) .Stfld("__proxymonitor") .Ret(); return(that); }
public void Emit( string propertyName, Type propertyType ) { var fieldName = $"_{Guid.NewGuid()}"; _dynamicTypeInfoField .WithField(fieldName, propertyType) .WithProperty( propertyName, propertyType, mget => mget .Ldarg(0) // this; .Ldfld(fieldName) .Ret(), mset => mset .Ldarg(0) // this; .Ldarg("value") .Stfld(fieldName) .Ret() ); }
public void Emit( string propertyName, Type propertyType ) { string fieldName = string.Format("_{0}", Guid.NewGuid()); dynamicTypeInfoField .WithField(fieldName, propertyType) .WithProperty( propertyName, propertyType, mget => mget .Ldarg(0) // this; .Ldfld(fieldName) .Ret(), mset => mset .Ldarg(0) // this; .Ldarg("value") .Stfld(fieldName) .Ret() ); }