/// <summary>
        /// Gets all of the interfaces that the 
        /// supplied <see cref="System.Type"/> implements.
        /// </summary>
        /// <remarks>
        /// This includes interfaces implemented by any superclasses.
        /// </remarks>
        /// <param name="type">
        /// The type to analyse for interfaces.
        /// </param>
        /// <returns>
        /// All of the interfaces that the supplied <see cref="System.Type"/> implements.
        /// </returns>
        public static Type[] GetAllInterfacesFromType(Type type)
        {
            AssertUtils.ArgumentNotNull(type, "type");
            ISet interfaces = new HybridSet();
            do
            {
                Type[] ifcs = type.GetInterfaces();
                foreach (Type ifc in ifcs)
                {
                    interfaces.Add(ifc);
                }
                type = type.BaseType;
            } while (type != null);

            if (interfaces.Count > 0)
            {
                Type[] types = new Type[interfaces.Count];
                interfaces.CopyTo(types, 0);
                return types;
            }
            return Type.EmptyTypes;
        }