MobileListItem.Implicit(String to MobileListItem) Operador

Definición

Proporciona la conversión implícita de un objeto String en un objeto MobileListItem. Esta API está obsoleta. Para obtener información sobre cómo desarrollar aplicaciones móviles ASP.NET, consulte Mobile Apps & Sites with 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

Parámetros

s
String

Cadena que se va a convertir.

Devoluciones

Un MobileListItem con la propiedad Text establecida en el Stringespecificado.

Ejemplos

En el ejemplo de código siguiente se crean varios MobileListItem objetos mediante la conversión implícita de cadenas y se agregan a un List control .

<%@ 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>

Comentarios

El MobileListItem objeto creado por la conversión implícita usa la entrada de cadena como valor de su Text propiedad.

Se aplica a

Consulte también