MobileListItem.Implicit(String to MobileListItem) 操作员

定义

提供从 StringMobileListItem 的隐式转换。 此 API 已废弃不用。 有关如何开发 ASP.NET 移动应用程序的信息,请参阅 移动应用 & 具有 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

参数

s
String

要转换的字符串。

返回

一个 MobileListItem,其 Text 被设置为指定的 String

示例

下面的代码示例使用从字符串的隐式转换创建多个 MobileListItem 对象,并将其添加到控件 List

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

注解

通过 MobileListItem 隐式转换创建的 对象使用字符串输入作为其 Text 属性的值。

适用于

另请参阅