Exemple #1
0
        // implement the following members as a convenience when extension methods aren't available

        /// <summary>
        /// Converts a reference to the given type by first trying a CLR cast, and then
        /// trying to get an adapter</summary>
        /// <typeparam name="T">Desired type, must be ref type</typeparam>
        /// <returns>Converted reference for the given object or null</returns>
        public T As <T>()
            where T : class
        {
            return(Adapters.As <T>(this));
        }
        // implement the following members as a convenience when extension methods aren't available

        /// <summary>
        /// Converts a reference to the given type by first trying a CLR cast, and then
        /// trying to get an adapter</summary>
        /// <typeparam name="U">Desired type, must be ref type</typeparam>
        /// <returns>Converted reference for the given object or null</returns>
        public U As <U>()
            where U : class
        {
            return(Adapters.As <U>(this));
        }