Exemplo n.º 1
0
        /// <summary>
        /// Checks the properties of the HttpBrowserCapabilities instance passed
        /// into the method for the property name contained in the property parameters
        /// string value.
        /// </summary>
        /// <param name="property">Property name to be found.</param>
        /// <param name="capabilities">Capabilities collection to be used.</param>
        /// <returns>If the property exists then return the associated value, otherwise null.</returns>
        private static string GetHttpBrowserCapabilitiesPropertyValue(string property, HttpBrowserCapabilities capabilities)
        {
            Type controlType = capabilities.GetType();

            System.Reflection.PropertyInfo propertyInfo = controlType.GetProperty(property);
            if (propertyInfo != null && propertyInfo.CanRead)
            {
                return(propertyInfo.GetValue(capabilities, null).ToString());
            }

            // Try browser capabilities next.
            string value = capabilities[property];

            if (value != null)
            {
                return(value);
            }

            return(null);
        }