Export (0) Print
Expand All
Expand Minimize

Item Property

.NET Framework 1.1

The default indexer for the MobileCapabilities class, inherited from the System.Web.HttpCapabilities class, allows the lookup of arbitrary capability values by name. Any of the properties can be accessed by name. However, the returned value will always be a string (or null if not defined), rather than a type safe value.

public string this[string key]

Example

The following example demonstrates how to use the Item property to access the PreferredRenderingMime capability.

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  
Dim currentCapabilities As MobileCapabilities = CType(Request.Browser, MobileCapabilities)

If Not (currentCapabilities("preferredRenderingMime") Is Nothing) Then
   Label1.Text = "value of PreferredRenderingMime is " + currentCapabilities("preferredRenderingMime")
End If

End Sub

[C#]

public void Page_Load(Object sender, EventArgs e)
{
   MobileCapabilities currentCapabilities
      =(MobileCapabilities)Request.Browser;
   if(currentCapabilities["preferredRenderingMime"] != null)
   {
      BrwInfo.Text = "value of PreferredRenderingMime is " + 
         currentCapabilities["preferredRenderingMime"];
   }
}

See Also

Applies to: MobileCapabilities Class

Show:
© 2014 Microsoft