EmptyControlCollection Sınıf

Tanım

Her zaman boş olan bir ControlCollection koleksiyon için standart destek sağlar.

public ref class EmptyControlCollection : System::Web::UI::ControlCollection
public class EmptyControlCollection : System.Web.UI.ControlCollection
type EmptyControlCollection = class
    inherit ControlCollection
Public Class EmptyControlCollection
Inherits ControlCollection
Devralma
EmptyControlCollection

Örnekler


/* File name: emptyControlCollection.cs. */

using System;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Collections;

namespace CustomControls
{

  // Defines a simple custom control.
  public class MyCS_EmptyControl : Control
  {
    [System.Security.Permissions.PermissionSet(System.Security.Permissions.SecurityAction.Demand, Name="FullTrust")] 
    protected override ControlCollection CreateControlCollection() 
    /*
     * Function Name: CreateControlCollection.
     * Denies the creation of any child control by creating an empty collection.
     * Generates an exception if an attempt to create a child control is made.
     */
     {
       return new EmptyControlCollection(this);
     }
     
     [System.Security.Permissions.PermissionSet(System.Security.Permissions.SecurityAction.Demand, Name="FullTrust")] 
     protected override void CreateChildControls()
     /*
      * Function Name: CreateChildControls.
      * Populates the child control collection (Controls). 
      * Note: This function will cause an exception because the control does not allow 
      * child controls.
      */
      {
        // Create a literal control to contain the header and add it to the collection.
        LiteralControl text;
        text = new LiteralControl("<h5>Composite Controls</h5>");
        Controls.Add(text);
      }
   }
}

' File name: emptyControlCollection.vb.

Imports System.Web
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.Collections


Namespace CustomControls 

  Public Class MyVB_EmptyControl 
    Inherits Control
    
    <System.Security.Permissions.PermissionSetAttribute(System.Security.Permissions.SecurityAction.Demand, Name:="FullTrust")> _
    Protected Overrides Function CreateControlCollection() As ControlCollection
    ' Function Name: CreateControlCollection.
    ' Denies the creation of any child control by creating an empty collection.
    ' Generates an exception if an attempt to create a child control is made.
      Return New EmptyControlCollection(Me)
    End Function 
    
    <System.Security.Permissions.PermissionSetAttribute(System.Security.Permissions.SecurityAction.Demand, Name:="FullTrust")> _  
    Protected Overrides Sub CreateChildControls()
    ' Sub Name: CreateChildControls.
    ' Populates the child control collection (Controls). 
    ' Note: This function will cause an exception because the control does not allow 
    ' child controls.
      Dim text As LiteralControl
      text = New LiteralControl("<h5>Composite Controls</h5>")
      Controls.Add(text)
    End Sub 
  End Class 

End Namespace

Açıklamalar

Bu sınıf, alt denetimlere izin vermeyen özel bir denetim tanımlamak istediğinizde kullanılır.

Oluşturucular

EmptyControlCollection(Control)

EmptyControlCollection sınıfının yeni bir örneğini başlatır.

Özellikler

Count

Belirtilen ASP.NET sunucu denetimi için nesnedeki ControlCollection sunucu denetimlerinin sayısını alır.

(Devralındığı yer: ControlCollection)
IsReadOnly

Nesnenin ControlCollection salt okunur olup olmadığını belirten bir değer alır.

(Devralındığı yer: ControlCollection)
IsSynchronized

Nesnenin ControlCollection eşitlenip eşitlenmediğini belirten bir değer alır.

(Devralındığı yer: ControlCollection)
Item[Int32]

Nesnede belirtilen dizin konumundaki sunucu denetimine başvuru alır ControlCollection .

(Devralındığı yer: ControlCollection)
Owner

Nesnenin ait olduğu ControlCollection ASP.NET sunucu denetimini alır.

(Devralındığı yer: ControlCollection)
SyncRoot

Denetim koleksiyonuna erişimi eşitlemek için kullanılabilecek bir nesne alır.

(Devralındığı yer: ControlCollection)

Yöntemler

Add(Control)

Belirtilen Control nesnenin koleksiyona eklenmesini reddeder.

AddAt(Int32, Control)

Belirtilen nesnenin belirtilen Control dizin konumunda koleksiyona eklenmesini reddeder.

Clear()

Geçerli sunucu denetiminin nesnesinden tüm denetimleri ControlCollection kaldırır.

(Devralındığı yer: ControlCollection)
Contains(Control)

Belirtilen sunucu denetiminin üst sunucu denetiminin ControlCollection nesnesinde olup olmadığını belirler.

(Devralındığı yer: ControlCollection)
CopyTo(Array, Int32)

nesnesinde ControlCollection depolanan alt denetimleri, içinde belirtilen dizin konumundan başlayarak bir Array nesneye Arraykopyalar.

(Devralındığı yer: ControlCollection)
Equals(Object)

Belirtilen nesnenin geçerli nesneye eşit olup olmadığını belirler.

(Devralındığı yer: Object)
GetEnumerator()

Nesnede yineleyebilecek bir numaralandırıcı alır ControlCollection .

(Devralındığı yer: ControlCollection)
GetHashCode()

Varsayılan karma işlevi işlevi görür.

(Devralındığı yer: Object)
GetType()

Type Geçerli örneğini alır.

(Devralındığı yer: Object)
IndexOf(Control)

Koleksiyondaki belirtilen Control nesnenin dizinini alır.

(Devralındığı yer: ControlCollection)
MemberwiseClone()

Geçerli Objectöğesinin sığ bir kopyasını oluşturur.

(Devralındığı yer: Object)
Remove(Control)

Belirtilen sunucu denetimini üst sunucu denetiminin ControlCollection nesnesinden kaldırır.

(Devralındığı yer: ControlCollection)
RemoveAt(Int32)

Belirtilen dizin konumundaki bir alt denetimi nesneden ControlCollection kaldırır.

(Devralındığı yer: ControlCollection)
ToString()

Geçerli nesneyi temsil eden dizeyi döndürür.

(Devralındığı yer: Object)

Uzantı Metotları

Cast<TResult>(IEnumerable)

öğesinin IEnumerable öğelerini belirtilen türe atar.

OfType<TResult>(IEnumerable)

Bir öğesinin IEnumerable öğelerini belirtilen türe göre filtreler.

AsParallel(IEnumerable)

Sorgunun paralelleştirilmesini sağlar.

AsQueryable(IEnumerable)

bir IEnumerable öğesini öğesine IQueryabledönüştürür.

Şunlara uygulanır