MobileListItem.Implicit(String to MobileListItem) Operatore

Definizione

Fornisce la conversione implicita da un oggetto String a un oggetto MobileListItem. Questa API è obsoleta. Per informazioni su come sviluppare applicazioni ASP.NET per dispositivi mobili, vedere App per dispositivi mobili & Siti con ASP.NET.

public:
 static operator System::Web::UI::MobileControls::MobileListItem ^(System::String ^ s);
public static implicit operator System.Web.UI.MobileControls.MobileListItem (string s);
static member op_Implicit : string -> System.Web.UI.MobileControls.MobileListItem
Public Shared Widening Operator CType (s As String) As MobileListItem

Parametri

s
String

Stringa da convertire.

Restituisce

Controllo MobileListItem con la proprietà Text impostata sull'oggetto String specificato.

Esempio

Nell'esempio di codice seguente vengono creati più MobileListItem oggetti usando la conversione implicita da stringhe e vengono aggiunti a un List controllo .

<%@ Page Language="C#" 
    Inherits="System.Web.UI.MobileControls.MobilePage" %>
<%@ Register TagPrefix="mobile" 
    Namespace="System.Web.UI.MobileControls" 
    Assembly="System.Web.Mobile" %>

<script runat="server">
    protected void Page_Load(object sender, EventArgs e)
    {
        MobileListItem mi;
        
        // Use implicit conversion to create 
        // new MobileListItem objects from strings
        mi = "One";
        List1.Items.Add(mi);
        mi = "Two";
        List1.Items.Add(mi);
    }
</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<body>
    <mobile:form id="form1" runat="server">
        <mobile:List ID="List1" Runat="server">
        </mobile:List>
    </mobile:form>
</body>
</html>
<%@ Page Language="VB" 
    Inherits="System.Web.UI.MobileControls.MobilePage" %>
<%@ Register TagPrefix="mobile" 
    Namespace="System.Web.UI.MobileControls" 
    Assembly="System.Web.Mobile" %>

<script runat="server">
    Protected Sub Page_Load(ByVal sender As Object, _
        ByVal e As System.EventArgs)
        Dim mi As MobileListItem
        
        ' Use implicit conversion to create 
        ' new MobileListItem objects from strings
        mi = "One"
        List1.Items.Add(mi)
        mi = "Two"
        List1.Items.Add(mi)
    End Sub
</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<body>
    <mobile:form id="form1" runat="server">
        <mobile:List ID="List1" Runat="server" />
    </mobile:form>
</body>
</html>

Commenti

L'oggetto MobileListItem creato dalla conversione implicita usa l'input stringa come valore della relativa Text proprietà.

Si applica a

Vedi anche