Share via


DeviceSpecificChoiceCollection Kelas

Definisi

Perhatian

The System.Web.Mobile.dll assembly has been deprecated and should no longer be used. For information about how to develop ASP.NET mobile applications, see http://go.microsoft.com/fwlink/?LinkId=157231.

Mewakili kumpulan pilihan untuk DeviceSpecific kelas . Untuk informasi tentang cara mengembangkan aplikasi seluler ASP.NET, lihat Situs & Mobile Apps dengan ASP.NET.

public ref class DeviceSpecificChoiceCollection : System::Web::UI::MobileControls::ArrayListCollectionBase
public class DeviceSpecificChoiceCollection : System.Web.UI.MobileControls.ArrayListCollectionBase
[System.Obsolete("The System.Web.Mobile.dll assembly has been deprecated and should no longer be used. For information about how to develop ASP.NET mobile applications, see http://go.microsoft.com/fwlink/?LinkId=157231.")]
public class DeviceSpecificChoiceCollection : System.Web.UI.MobileControls.ArrayListCollectionBase
type DeviceSpecificChoiceCollection = class
    inherit ArrayListCollectionBase
[<System.Obsolete("The System.Web.Mobile.dll assembly has been deprecated and should no longer be used. For information about how to develop ASP.NET mobile applications, see http://go.microsoft.com/fwlink/?LinkId=157231.")>]
type DeviceSpecificChoiceCollection = class
    inherit ArrayListCollectionBase
Public Class DeviceSpecificChoiceCollection
Inherits ArrayListCollectionBase
Warisan
DeviceSpecificChoiceCollection
Atribut

Contoh

Contoh kode berikut menunjukkan cara menggunakan DeviceSpecificChoiceCollection kelas untuk mendapatkan akses ke pilihan dalam konstruksi DeviceSpecific/Choice. Untuk kenyamanan Anda, file Web.config yang berisi filter mengikuti kode contoh.

Catatan

Sampel kode berikut menggunakan model kode file tunggal dan mungkin tidak berfungsi dengan benar jika disalin langsung ke file code-behind. Sampel kode ini harus disalin ke dalam file teks kosong yang memiliki ekstensi .aspx. Untuk informasi selengkapnya, lihat Model Kode Halaman Formulir Web ASP.NET.

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

<script runat="server">
    public void Page_Load(Object sender, EventArgs e)
    {
        int count = this.Panel1.DeviceSpecific.Choices.Count;

        // Cycle through the DeviceSpecificChoiceCollection.
        for (int i = 0; i < count; i++)
        {
            string txt1 = "Choice {0} has {1} Templates. ";
            string txt2 = "Filter name is '{0}'. ";

            Label1.Text += String.Format(txt1, i,
                Panel1.DeviceSpecific.Choices[i].Templates.Count);
            Label2.Text += String.Format(txt2,
                Panel1.DeviceSpecific.Choices[i].Filter);
        }
    }

    //<Snippet3>
    // Add a DeviceSpecificChoice section programatically
    protected void form1_Init(object sender, EventArgs e)
    {
        DeviceSpecific devSpecific = Panel1.DeviceSpecific;
        DeviceSpecificChoice devChoiceHtml = new DeviceSpecificChoice();
        devChoiceHtml.Filter = "isCHTML10";
        devSpecific.Choices.Add(devChoiceHtml);
        ((IParserAccessor)form1).AddParsedSubObject(devSpecific);
    }
    //</Snippet3>
</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<body>
    <mobile:Form ID="form1" Runat="server" OnInit="form1_Init">
        <mobile:Panel id="Panel1" Runat="server">
            <mobile:DeviceSpecific Runat="server">
                <Choice Filter="isHTML32">
                    <ContentTemplate>
                        <!-- For HTML Browsers -->
                        <br />
                        <mobile:Label ID="Label3" Runat="server" 
                            Text="Visible in an HTML Browser" />
                        <br />
                    </ContentTemplate>
                </Choice>
                <Choice Filter="isWML11">
                    <ContentTemplate>
                        <!-- For WML Browsers -->
                        <br />
                        <mobile:Label ID="Label4" Runat="server" 
                            Text="Viewable in a WML browser" />
                        <br />
                    </ContentTemplate>
                </Choice>
            </mobile:DeviceSpecific>
        </mobile:Panel>
        <mobile:Label id="Label1" Runat="server" Font-Bold="true" />
        <mobile:Label ID="Label2" Runat="server" Font-Bold="true" />
    </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" %>
<%@ Import Namespace="System.Web.Mobile" %>

<script runat="server">
    Private Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
        Dim count As Integer = Panel1.DeviceSpecific.Choices.Count
        Dim i As Integer
        
        ' Cycle through the DeviceSpecificChoiceCollection.
        For i = 0 To count - 1
            Dim txt1 As String = "Choice {0} has {1} Templates. "
            Dim txt2 As String = "Filter name is '{0}'. "
            
            Label1.Text &= String.Format(txt1, i, _
                Panel1.DeviceSpecific.Choices(i).Templates.Count)
            Label2.Text &= String.Format(txt2, _
                Panel1.DeviceSpecific.Choices(i).Filter)
        Next
    End Sub
    
    '<Snippet3>
    ' Add a DeviceSpecificChoice section programatically
    Protected Sub form1_Init(ByVal sender As Object, ByVal e As EventArgs)
        Dim devSpecific As DeviceSpecific = Panel1.DeviceSpecific
        Dim devChoiceHtml As DeviceSpecificChoice = New DeviceSpecificChoice()
        devChoiceHtml.Filter = "isCHTML10"
        devSpecific.Choices.Add(devChoiceHtml)
        CType(form1, IParserAccessor).AddParsedSubObject(devSpecific)
    End Sub
    '</Snippet3>
</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<body>
    <mobile:form id="form1" runat="server">
        <mobile:Panel id="Panel1" Runat="server">
            <mobile:DeviceSpecific ID="DeviceSpecific1" Runat="server">
                <Choice Filter="isHTML32">
                    <ContentTemplate>
                        <!-- For HTML Browsers -->
                        <br />
                        <mobile:Label ID="Label3" Runat="server" 
                            Text="Visible in an HTML Browser" />
                        <br />
                    </ContentTemplate>
                </Choice>
                <Choice Filter="isWML11">
                    <ContentTemplate>
                        <!-- For WML Browsers -->
                        <br />
                        <mobile:Label ID="Label4" Runat="server" 
                            Text="Viewable in a WML browser" />
                        <br />
                    </ContentTemplate>
                </Choice>
            </mobile:DeviceSpecific>
        </mobile:Panel>
        <mobile:Label id="Label1" Runat="server" Font-Bold="true" />
        <mobile:Label ID="Label2" Runat="server" Font-Bold="true" />
    </mobile:form>
</body>
</html>

Keterangan

Choices Mengakses properti DeviceSpecific objek mengambil DeviceSpecificChoiceCollection objek. Koleksi ini mengimplementasikan ICollection antarmuka (melalui ArrayListCollectionBase objek); mengimplementasikan semua properti dan metode ICollection antarmuka.

Properti

All
Kedaluwarsa.

Mengambil array DeviceSpecificChoice objek dari koleksi. API ini kedaluarsa. Untuk informasi tentang cara mengembangkan aplikasi seluler ASP.NET, lihat Situs & Mobile Apps dengan ASP.NET.

Count
Kedaluwarsa.

Mengembalikan jumlah elemen dalam koleksi. API ini kedaluarsa. Untuk informasi tentang cara mengembangkan aplikasi seluler ASP.NET, lihat Situs & Mobile Apps dengan ASP.NET. API ini kedaluarsa. Untuk informasi tentang cara mengembangkan aplikasi seluler ASP.NET, lihat Situs & Mobile Apps dengan ASP.NET.

(Diperoleh dari ArrayListCollectionBase)
IsReadOnly
Kedaluwarsa.

Mendapatkan nilai yang menunjukkan apakah koleksi bersifat baca-saja. API ini kedaluarsa. Untuk informasi tentang cara mengembangkan aplikasi seluler ASP.NET, lihat Situs & Mobile Apps dengan ASP.NET. API ini kedaluarsa. Untuk informasi tentang cara mengembangkan aplikasi seluler ASP.NET, lihat Situs & Mobile Apps dengan ASP.NET.

(Diperoleh dari ArrayListCollectionBase)
IsSynchronized
Kedaluwarsa.

Mendapatkan nilai yang menunjukkan apakah koleksi disinkronkan. API ini kedaluarsa. Untuk informasi tentang cara mengembangkan aplikasi seluler ASP.NET, lihat Situs & Mobile Apps dengan ASP.NET. API ini kedaluarsa. Untuk informasi tentang cara mengembangkan aplikasi seluler ASP.NET, lihat Situs & Mobile Apps dengan ASP.NET.

(Diperoleh dari ArrayListCollectionBase)
Item[Int32]
Kedaluwarsa.

Mengembalikan DeviceSpecificChoice item dalam koleksi, menurut indeks. API ini kedaluarsa. Untuk informasi tentang cara mengembangkan aplikasi seluler ASP.NET, lihat Situs & Mobile Apps dengan ASP.NET.

Items
Kedaluwarsa.

Mendapatkan atau mengatur kumpulan item dalam objek daftar array. Nilai defaultnya adalah Empty. API ini kedaluarsa. Untuk informasi tentang cara mengembangkan aplikasi seluler ASP.NET, lihat Situs & Mobile Apps dengan ASP.NET.

(Diperoleh dari ArrayListCollectionBase)
SyncRoot
Kedaluwarsa.

Mengembalikan objek SyncRoot untuk koleksi. API ini kedaluarsa. Untuk informasi tentang cara mengembangkan aplikasi seluler ASP.NET, lihat Situs & Mobile Apps dengan ASP.NET.

(Diperoleh dari ArrayListCollectionBase)

Metode

Add(DeviceSpecificChoice)
Kedaluwarsa.

DeviceSpecificChoice Menambahkan objek ke akhir koleksi. API ini kedaluarsa. Untuk informasi tentang cara mengembangkan aplikasi seluler ASP.NET, lihat Situs & Mobile Apps dengan ASP.NET.

AddAt(Int32, DeviceSpecificChoice)
Kedaluwarsa.

Menambahkan pilihan di lokasi dalam koleksi yang ditentukan oleh index parameter . API ini kedaluarsa. Untuk informasi tentang cara mengembangkan aplikasi seluler ASP.NET, lihat Situs & Mobile Apps dengan ASP.NET.

Clear()
Kedaluwarsa.

Menghapus koleksi. API ini kedaluarsa. Untuk informasi tentang cara mengembangkan aplikasi seluler ASP.NET, lihat Situs & Mobile Apps dengan ASP.NET.

CopyTo(Array, Int32)
Kedaluwarsa.

Menyalin item dalam koleksi ke array, dimulai dari indeks yang diberikan. Ditujukan hanya untuk penggunaan internal. API ini kedaluarsa. Untuk informasi tentang cara mengembangkan aplikasi seluler ASP.NET, lihat Situs & Mobile Apps dengan ASP.NET. API ini kedaluarsa. Untuk informasi tentang cara mengembangkan aplikasi seluler ASP.NET, lihat Situs & Mobile Apps dengan ASP.NET.

(Diperoleh dari ArrayListCollectionBase)
Equals(Object)
Kedaluwarsa.

Menentukan apakah objek yang ditentukan sama dengan objek saat ini.

(Diperoleh dari Object)
GetEnumerator()
Kedaluwarsa.

Mengambil enumerator untuk koleksi. API ini kedaluarsa. Untuk informasi tentang cara mengembangkan aplikasi seluler ASP.NET, lihat Situs & Mobile Apps dengan ASP.NET. API ini kedaluarsa. Untuk informasi tentang cara mengembangkan aplikasi seluler ASP.NET, lihat Situs & Mobile Apps dengan ASP.NET.

(Diperoleh dari ArrayListCollectionBase)
GetHashCode()
Kedaluwarsa.

Berfungsi sebagai fungsi hash default.

(Diperoleh dari Object)
GetType()
Kedaluwarsa.

Mendapatkan dari instans Type saat ini.

(Diperoleh dari Object)
MemberwiseClone()
Kedaluwarsa.

Membuat salinan dangkal dari saat ini Object.

(Diperoleh dari Object)
Remove(DeviceSpecificChoice)
Kedaluwarsa.

Menghapus pilihan yang ditentukan. API ini kedaluarsa. Untuk informasi tentang cara mengembangkan aplikasi seluler ASP.NET, lihat Situs & Mobile Apps dengan ASP.NET.

RemoveAt(Int32)
Kedaluwarsa.

Menghapus item pada indeks yang ditentukan. API ini kedaluarsa. Untuk informasi tentang cara mengembangkan aplikasi seluler ASP.NET, lihat Situs & Mobile Apps dengan ASP.NET.

ToString()
Kedaluwarsa.

Mengembalikan string yang mewakili objek saat ini.

(Diperoleh dari Object)

Metode Ekstensi

Cast<TResult>(IEnumerable)
Kedaluwarsa.

Mentransmisikan elemen dari ke IEnumerable jenis yang ditentukan.

OfType<TResult>(IEnumerable)
Kedaluwarsa.

Memfilter elemen berdasarkan IEnumerable jenis yang ditentukan.

AsParallel(IEnumerable)
Kedaluwarsa.

Mengaktifkan paralelisasi kueri.

AsQueryable(IEnumerable)
Kedaluwarsa.

Mengonversi menjadi IEnumerableIQueryable.

Berlaku untuk

Lihat juga