コード例 #1
0
        /// <summary>
        /// Retourne l'action correspondant à cette instruction.
        /// </summary>
        public Action <Context> GetAction()
        {
            return(delegate(Context c)
            {
                object evtObj = Event.GetValue(c);
                object delObj = Delegate.GetValue(c);

                // Vérifications :
                if (!(evtObj is InternalEventRepresentation))
                {
                    throw new InterpreterException("The left member of the subscription must be an event.");
                }
                if (!(delObj is Delegate))
                {
                    throw new InterpreterException("The right member of the subscription must be a delegate.");
                }
                // Casts :
                InternalEventRepresentation evt = (InternalEventRepresentation)evtObj;
                Delegate del = (Delegate)delObj;

                evt.Event.AddEventHandler(evt.Owner, del);
            });
        }
コード例 #2
0
 public static T GetValue <T>(this IGettable gettable)
 {
     return((T)gettable.GetValue(typeof(T)));
 }
コード例 #3
0
 public static object GetValue(this IGettable gettable, Type type)
 {
     return(ConversionUtility.Convert(gettable.GetValue(), type));
 }