本文整理汇总了C#中System.CodeDom.CodeDelegateCreateExpression.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# CodeDelegateCreateExpression.GetType方法的具体用法?C# CodeDelegateCreateExpression.GetType怎么用?C# CodeDelegateCreateExpression.GetType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.CodeDom.CodeDelegateCreateExpression
的用法示例。
在下文中一共展示了CodeDelegateCreateExpression.GetType方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Serialize
public override void Serialize (IDesignerSerializationManager manager, object value, MemberDescriptor descriptor, CodeStatementCollection statements)
{
if (statements == null)
throw new ArgumentNullException ("statements");
if (manager == null)
throw new ArgumentNullException ("manager");
if (value == null)
throw new ArgumentNullException ("value");
if (descriptor == null)
throw new ArgumentNullException ("descriptor");
IEventBindingService service = manager.GetService (typeof (IEventBindingService)) as IEventBindingService;
if (service != null) {
EventDescriptor eventDescriptor = (EventDescriptor) descriptor;
string methodName = (string) service.GetEventProperty (eventDescriptor).GetValue (value);
if (methodName != null) {
CodeDelegateCreateExpression listener = new CodeDelegateCreateExpression (new CodeTypeReference (eventDescriptor.EventType),
_thisReference, methodName);
manager.Context.Push (new ExpressionContext (listener, listener.GetType (), null, eventDescriptor));
CodeExpression targetObject = base.SerializeToExpression (manager, value);
manager.Context.Pop ();
CodeEventReferenceExpression eventRef = new CodeEventReferenceExpression (targetObject, eventDescriptor.Name);
statements.Add (new CodeAttachEventStatement (eventRef, listener));
}
}
}