本文整理汇总了C#中GeneratorContext.MixinsAsArray方法的典型用法代码示例。如果您正苦于以下问题:C# GeneratorContext.MixinsAsArray方法的具体用法?C# GeneratorContext.MixinsAsArray怎么用?C# GeneratorContext.MixinsAsArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GeneratorContext
的用法示例。
在下文中一共展示了GeneratorContext.MixinsAsArray方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RecreateInterfaceProxy
public object RecreateInterfaceProxy(SerializationInfo info, StreamingContext context)
{
object proxy = null;
GeneratorContext genContext = new GeneratorContext();
foreach(object mixin in _mixins)
{
genContext.AddMixinInstance(mixin);
}
InterfaceProxyGenerator gen = new InterfaceProxyGenerator( _scope, genContext );
object target = info.GetValue("__target", typeof(object));
if (_mixins.Length == 0)
{
Type proxy_type = gen.GenerateCode( _interfaces, target.GetType());
proxy = Activator.CreateInstance( proxy_type, new object[] { _interceptor, target } );
}
else
{
Type proxy_type = gen.GenerateCode( _interfaces, target.GetType() );
proxy = Activator.CreateInstance( proxy_type, new object[] { _interceptor, target, genContext.MixinsAsArray() } );
}
return proxy;
}
示例2: RecreateClassProxy
public object RecreateClassProxy(SerializationInfo info, StreamingContext context)
{
bool delegateBaseSer = info.GetBoolean("__delegateToBase");
if (!delegateBaseSer)
{
_data = (object[]) info.GetValue("__data", typeof(object[]) );
}
object proxy = null;
GeneratorContext genContext = new GeneratorContext();
if (_mixins.Length != 0)
{
foreach(object mixin in _mixins)
{
genContext.AddMixinInstance(mixin);
}
}
ClassProxyGenerator cpGen = new ClassProxyGenerator( _scope, genContext );
Type proxy_type;
if (_mixins.Length == 0)
{
proxy_type = cpGen.GenerateCode( _baseType, _interfaces );
}
else
{
proxy_type = cpGen.GenerateCustomCode( _baseType, _interfaces );
}
if (delegateBaseSer)
{
proxy = Activator.CreateInstance( proxy_type, new object[] { info, context } );
}
else
{
if (_mixins.Length == 0)
{
proxy = Activator.CreateInstance( proxy_type, new object[] { _interceptor } );
}
else
{
ArrayList args = new ArrayList();
args.Add(_interceptor);
args.Add(genContext.MixinsAsArray());
proxy = Activator.CreateInstance( proxy_type, args.ToArray() );
}
MemberInfo[] members = FormatterServices.GetSerializableMembers( _baseType );
FormatterServices.PopulateObjectMembers(proxy, members, _data);
}
return proxy;
}