Exemplo n.º 1
0
        // Equality checking

        protected override bool ContentEquals(Result other)
        {
            CompositeResult cr = (CompositeResult)other;

            Result[] mine   = GetItems();
            Result[] theirs = cr.GetItems();

            for (int i = 0; i < mine.Length; i++)
            {
                if (mine[i] != theirs[i])
                {
                    return(false);
                }
            }

            return(true);
        }
Exemplo n.º 2
0
        public static Result FindCompatible(Result res, Type type)
        {
            // Check types, tunneling through default members of compat
            // results.

            bool gotit = false;

            while (!gotit)
            {
                if (type.IsInstanceOfType(res))
                {
                    gotit = true;
                    break;
                }

                if (!(res is CompositeResult))
                {
                    break;
                }

                CompositeResult cr = (CompositeResult)res;

                if (!cr.HasDefault || cr.Default == null)
                {
                    break;
                }

                res = cr.Default;
            }

            if (gotit == false)
            {
                return(null);
            }

            return(res);
        }