Exemplo n.º 1
0
 protected virtual void OnCollectionChanged(NotifyCollectionChangedAction action, List <T> items, int?index = null)
 {
     if (index.HasValue)
     {
         CollectionChanged(this, new NotifyCollectionChangedEventArgs(action, items, index.Value));
     }
     else
     {
         CollectionChanged(this, new NotifyCollectionChangedEventArgs(action, items));
     }
     OnPropertyChanged(ClrExtensions.PropertyName(() => Count));
 }
Exemplo n.º 2
0
        public static object CallMethod(string methodName, IList <Type> typeArgs, bool isStatic, Type t, object target, params object[] args)
        {
            Expression        targetExpr = isStatic ? Expression.Constant(t, typeof(Type)) : Expression.Constant(target);
            List <Expression> exprs      = new List <Expression>();

            foreach (object arg in args)
            {
                exprs.Add(Expression.Constant(arg));
            }

            Expression[] argExprs = ClrExtensions.ArrayInsert <Expression>(targetExpr, exprs);

            // TODO: Get rid of Default
            InvokeMemberBinder binder = new ClojureInvokeMemberBinder(ClojureContext.Default, methodName, argExprs.Length, isStatic);

            Expression dyn = Expression.Dynamic(binder, typeof(object), argExprs);

            LambdaExpression lambda = Expression.Lambda <clojure.lang.Compiler.ReplDelegate>(dyn);

            return(lambda.Compile().DynamicInvoke());
        }
Exemplo n.º 3
0
 public new virtual void TrimExcess()
 {
     base.TrimExcess();
     OnPropertyChanged(ClrExtensions.PropertyName(() => Count));
 }