Пример #1
0
        public static Delegate Combine(Delegate a, Delegate b)
        {
            if ((Object)a == null)
                return b;

            return a.CombineImpl(b);
        }
Пример #2
0
        /// <summary>Concatenates the invocation lists of two delegates.</summary><returns>A new delegate with an invocation list that concatenates the invocation lists of <paramref name="a" /> and <paramref name="b" /> in that order. Returns <paramref name="a" /> if <paramref name="b" /> is null, returns <paramref name="b" /> if <paramref name="a" /> is a null reference, and returns a null reference if both <paramref name="a" /> and <paramref name="b" /> are null references.</returns><param name="a">The delegate whose invocation list comes first. </param><param name="b">The delegate whose invocation list comes last. </param><exception cref="T:System.ArgumentException">Both <paramref name="a" /> and <paramref name="b" /> are not null, and <paramref name="a" /> and <paramref name="b" /> are not instances of the same delegate type. </exception><filterpriority>1</filterpriority>
        public static Delegate Combine(Delegate a, Delegate b)
        {
            if (a == null)
            {
                if (b == null)
                {
                    return(null);
                }
                else
                {
                    return(b);
                }
            }
            else if (b == null)
            {
                return(a);
            }

            if (a.getClass().getName() != b.getClass().getName())
            {
                throw new ArgumentException(Local.GetText("Incompatible Delegate Types. First is {0} second is {1}.", a.getClass().getName(), b.getClass().getName()));
            }

            return(a.CombineImpl(b));
        }
Пример #3
0
        // Combine creates a new delegate based upon the contents of the
        //  delegates passed in.
        /// <include file='doc\Delegate.uex' path='docs/doc[@for="Delegate.Combine"]/*' />
        public static Delegate Combine(Delegate a, Delegate b)
        {
            //@TODO: Should this really check to see that they are both multicast
            //      because it really is an error to try and combine non-multicasts?
            //      Spec says that it returns null and only does the check if a and b
            //      are both null.

            // boundry conditions -- if either (or both) delegates is null
            //      return the other.
            if (a == null)
            {
                return(b);
            }
            if (b == null)
            {
                return(a);
            }

            // Verify that the types are the same...
            if (a.GetType() != b.GetType())
            {
                throw new ArgumentException(Environment.GetResourceString("Arg_DlgtTypeMis"));
            }
            return(a.CombineImpl(b));
        }
Пример #4
0
 public static Delegate Combine(Delegate a, Delegate b)
 {
     if (a == null)
     {
         return(b);
     }
     return(a.CombineImpl(b));
 }
Пример #5
0
        public static Delegate Combine(Delegate a, Delegate b)
        {
            if ((Object)a == null) // cast to object for a more efficient test
            {
                return(b);
            }

            return(a.CombineImpl(b));
        }
Пример #6
0
        public static Delegate Combine(Delegate a, Delegate b)
        {
            if (a == null) {
                return b;
            } else if (b == null) {
                return a;
            }

            if (a.GetType() != b.GetType()) {
                throw new ArgumentException("Incompatible delegate types");
            }

            return a.CombineImpl(b);
        }
Пример #7
0
        public static Delegate Combine(Delegate a, Delegate b)
        {
            if (a == null)
            {
                return(b);
            }
            else if (b == null)
            {
                return(a);
            }

            if (a.GetType() != b.GetType())
            {
                throw new ArgumentException("Incompatible delegate types");
            }

            return(a.CombineImpl(b));
        }
Пример #8
0
 // Combine the invocation lists of two delegates.
 public static Delegate Combine(Delegate a, Delegate b)
 {
     if (((Object)a) == null)
     {
         return(b);
     }
     else if (((Object)b) == null)
     {
         return(a);
     }
     else if (a.GetType() != b.GetType())
     {
         throw new ArgumentException(_("Arg_DelegateMismatch"));
     }
     else
     {
         return(a.CombineImpl(b));
     }
 }
Пример #9
0
        /// <symmary>
        ///   Returns a new MulticastDelegate holding the
        ///   concatenated invocation lists of MulticastDelegates a and b
        /// </symmary>
        public static Delegate Combine(Delegate a, Delegate b)
        {
            if (a == null)
            {
                return(b);
            }

            if (b == null)
            {
                return(a);
            }

            if (a.GetType() != b.GetType())
            {
                throw new ArgumentException(Locale.GetText("Incompatible Delegate Types. First is {0} second is {1}.", a.GetType().FullName, b.GetType().FullName));
            }

            return(a.CombineImpl(b));
        }
Пример #10
0
        // Combine creates a new delegate based upon the contents of the
        //  delegates passed in.
        /// <include file='doc\Delegate.uex' path='docs/doc[@for="Delegate.Combine"]/*' />
        public static Delegate Combine(Delegate a, Delegate b)
        {
            // boundry conditions -- if either (or both) delegates is null
            //      return the other.
            if (a == null)
            {
                return(b);
            }
            if (b == null)
            {
                return(a);
            }

            // Verify that the types are the same...
            if (a.GetType() != b.GetType())
            {
                throw new ArgumentException(Environment.GetResourceString("Arg_DlgtTypeMis"));
            }
            return(a.CombineImpl(b));
        }
Пример #11
0
        public static Delegate Combine(Delegate a, Delegate b)
        {
            // boundry conditions -- if either (or both) delegates is null
            //      return the other.
            if ((Object)a == null) // cast to object for a more efficient test
            {
                return(b);
            }
            if ((Object)b == null) // cast to object for a more efficient test
            {
                return(a);
            }

            if (!InternalEqualTypes(a, b))
            {
                throw new ArgumentException(Environment.GetResourceString("Arg_DlgtTypeMis"));
            }

            return(a.CombineImpl(b));
        }
Пример #12
0
        /// <symmary>
        ///   Returns a new MulticastDelegate holding the
        ///   concatenated invocation lists of MulticastDelegates a and b
        /// </symmary>
        public static Delegate Combine(Delegate a, Delegate b)
        {
            if (a == null)
            {
                if (b == null)
                {
                    return(null);
                }
                return(b);
            }
            else
            if (b == null)
            {
                return(a);
            }

            if (a.GetType() != b.GetType())
            {
                throw new ArgumentException(Locale.GetText("Incompatible Delegate Types."));
            }
            //
            //  Beginn Pre-JIT/-Patch Code
            //
            Delegate retval = a.CombineImpl(b);

//			Console.WriteLine("Delegate.Combine:\ta: {0:X}\tb: {1:X}\tretval: {2:X}", (a.obj_address()).ToInt32(), (b.obj_address()).ToInt32(), (retval.obj_address()).ToInt32());
            if ((a != retval) && (retval != null))
            {
                retval.combinedDelegate();
            }
            return(retval);
            //
            //  Ende Pre-JIT/-Patch Code
            //
            // return a.CombineImpl (b);
        }
Пример #13
0
        public unsafe static Delegate Combine(Delegate a, Delegate b)
        {
            if (a == null)
                return b;
            if (b == null)
                return a;

            return a.CombineImpl(b);
        }
Пример #14
0
		public static Delegate Combine(Delegate a, Delegate b)
		{
			if (a == null)
			{
				return b;
			}
			return a.CombineImpl(b);
		}
Пример #15
0
		/// <symmary>
		///   Returns a new MulticastDelegate holding the
		///   concatenated invocation lists of MulticastDelegates a and b
		/// </symmary>
		public static Delegate Combine (Delegate a, Delegate b)
		{
			if (a == null) {
				if (b == null)
					return null;
				return b;
			} else 
				if (b == null)
					return a;

			if (a.GetType () != b.GetType ())
				throw new ArgumentException (Locale.GetText ("Incompatible Delegate Types."));
			
			return a.CombineImpl (b);
		}
Пример #16
0
		/// <symmary>
		///   Returns a new MulticastDelegate holding the
		///   concatenated invocation lists of MulticastDelegates a and b
		/// </symmary>
		public static Delegate Combine (Delegate a, Delegate b)
		{
			if (a == null) {
				if (b == null)
					return null;
				return b;
			} else 
				if (b == null)
					return a;

			if (a.GetType () != b.GetType ())
				throw new ArgumentException (Locale.GetText ("Incompatible Delegate Types. First is {0} second is {1}.", a.GetType ().FullName, b.GetType ().FullName));
			
			return a.CombineImpl (b);
		}
Пример #17
0
 // Combine creates a new delegate based upon the contents of the 
 //  delegates passed in.
 /// <include file='doc\Delegate.uex' path='docs/doc[@for="Delegate.Combine"]/*' />
 public static Delegate Combine(Delegate a, Delegate b)
 {
             
             // boundry conditions -- if either (or both) delegates is null
             //      return the other.
     if (a == null)
         return b;
     if (b == null)
         return a;
             
             // Verify that the types are the same...
     if (a.GetType() != b.GetType())
         throw new ArgumentException(Environment.GetResourceString("Arg_DlgtTypeMis"));
     return  a.CombineImpl(b);
 }
Пример #18
0
        public static Delegate Combine(Delegate a, Delegate b)
        {
            if ((Object)a == null) // cast to object for a more efficient test
                return b;

            return  a.CombineImpl(b);
        }
Пример #19
0
 public static Delegate Combine(Delegate a, Delegate b)
 {
     // boundry conditions -- if either (or both) delegates is null
     //      return the other.
     if ((Object)a == null) // cast to object for a more efficient test
         return b;
     if ((Object)b == null) // cast to object for a more efficient test
         return a;
             
     if (!InternalEqualTypes(a, b))
         throw new ArgumentException(Environment.GetResourceString("Arg_DlgtTypeMis"));
     
     return  a.CombineImpl(b);
 }