本文整理汇总了C#中System.Web.HttpBrowserCapabilities.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# HttpBrowserCapabilities.GetType方法的具体用法?C# HttpBrowserCapabilities.GetType怎么用?C# HttpBrowserCapabilities.GetType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Web.HttpBrowserCapabilities
的用法示例。
在下文中一共展示了HttpBrowserCapabilities.GetType方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetHttpBrowserCapabilitiesPropertyValue
/// <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;
}