Share via


CodeDirectiveCollection Sınıf

Tanım

Nesne koleksiyonunu CodeDirective temsil eder.

public ref class CodeDirectiveCollection : System::Collections::CollectionBase
public class CodeDirectiveCollection : System.Collections.CollectionBase
[System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.AutoDispatch)]
[System.Runtime.InteropServices.ComVisible(true)]
[System.Serializable]
public class CodeDirectiveCollection : System.Collections.CollectionBase
type CodeDirectiveCollection = class
    inherit CollectionBase
[<System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.AutoDispatch)>]
[<System.Runtime.InteropServices.ComVisible(true)>]
[<System.Serializable>]
type CodeDirectiveCollection = class
    inherit CollectionBase
Public Class CodeDirectiveCollection
Inherits CollectionBase
Devralma
CodeDirectiveCollection
Öznitelikler

Örnekler

Aşağıdaki kod örneği, sınıfın üyelerinin CodeDirectiveCollection kullanımını gösterir.

// Creates an empty CodeDirectiveCollection.
CodeDirectiveCollection collection = new CodeDirectiveCollection();

// Adds a CodeDirective to the collection.
collection.Add(new CodeRegionDirective(CodeRegionMode.Start, "Region1"));

// Adds an array of CodeDirective objects to the collection.
CodeDirective[] directives = {
    new CodeRegionDirective(CodeRegionMode.Start,"Region1"),
    new CodeRegionDirective(CodeRegionMode.End,"Region1") };
collection.AddRange(directives);

// Adds a collection of CodeDirective objects to the collection.
CodeDirectiveCollection directivesCollection = new CodeDirectiveCollection();
directivesCollection.Add(new CodeRegionDirective(CodeRegionMode.Start, "Region2"));
directivesCollection.Add(new CodeRegionDirective(CodeRegionMode.End, "Region2"));
collection.AddRange(directivesCollection);

// Tests for the presence of a CodeDirective in the
// collection, and retrieves its index if it is found.
CodeDirective testDirective = new CodeRegionDirective(CodeRegionMode.Start, "Region1");
int itemIndex = -1;
if (collection.Contains(testDirective))
    itemIndex = collection.IndexOf(testDirective);

// Copies the contents of the collection beginning at index 0 to the specified CodeDirective array.
// 'directives' is a CodeDirective array.
collection.CopyTo(directives, 0);

// Retrieves the count of the items in the collection.
int collectionCount = collection.Count;

// Inserts a CodeDirective at index 0 of the collection.
collection.Insert(0, new CodeRegionDirective(CodeRegionMode.Start, "Region1"));

// Removes the specified CodeDirective from the collection.
CodeDirective directive = new CodeRegionDirective(CodeRegionMode.Start, "Region1");
collection.Remove(directive);

// Removes the CodeDirective at index 0.
collection.RemoveAt(0);
        ' Creates an empty CodeDirectiveCollection.
        Dim collection As New CodeDirectiveCollection()
        ' Adds a CodeDirective to the collection.
        collection.Add(New CodeRegionDirective(CodeRegionMode.Start, "Region1"))
        ' Adds an array of CodeDirective objects to the collection.
        Dim directives As CodeDirective() = {New CodeRegionDirective(CodeRegionMode.Start, "Region1"), New CodeRegionDirective(CodeRegionMode.End, "Region1")}
        collection.AddRange(directives)

        ' Adds a collection of CodeDirective objects to the collection.
        Dim directivesCollection As New CodeDirectiveCollection()
        directivesCollection.Add(New CodeRegionDirective(CodeRegionMode.Start, "Region2"))
        directivesCollection.Add(New CodeRegionDirective(CodeRegionMode.End, "Region2"))
        collection.AddRange(directivesCollection)
        ' Tests for the presence of a CodeDirective in the 
        ' collection, and retrieves its index if it is found.
        Dim testDirective = New CodeRegionDirective(CodeRegionMode.Start, "Region1")
        Dim itemIndex As Integer = -1
        If collection.Contains(testDirective) Then
            itemIndex = collection.IndexOf(testDirective)
        End If
        ' Copies the contents of the collection beginning at index 0 to the specified CodeDirective array.
        ' 'directives' is a CodeDirective array.
        collection.CopyTo(directives, 0)
        ' Retrieves the count of the items in the collection.
        Dim collectionCount As Integer = collection.Count
        ' Inserts a CodeDirective at index 0 of the collection.
        collection.Insert(0, New CodeRegionDirective(CodeRegionMode.Start, "Region1"))
        ' Removes the specified CodeDirective from the collection.
        Dim directive = New CodeRegionDirective(CodeRegionMode.Start, "Region1")
        collection.Remove(directive)
        ' Removes the CodeDirective at index 0.
        collection.RemoveAt(0)
    
    End Sub
End Class

Açıklamalar

sınıfı, CodeDirectiveCollection bir nesne kümesini CodeDirective depolamak için kullanılabilecek basit bir koleksiyon nesnesi sağlar.

Oluşturucular

CodeDirectiveCollection()

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

CodeDirectiveCollection(CodeDirective[])

Belirtilen dizideki CodeDirectiveCollection kod yönergesi nesneleriyle sınıfının yeni bir örneğini başlatır.

CodeDirectiveCollection(CodeDirectiveCollection)

Belirtilen kod yönergesi koleksiyonundaki CodeDirectiveCollection öğelerle sınıfının yeni bir örneğini başlatır.

Özellikler

Capacity

öğesinin içerebileceği öğe CollectionBase sayısını alır veya ayarlar.

(Devralındığı yer: CollectionBase)
Count

Örnekte bulunan CollectionBase öğelerin sayısını alır. Bu özellik geçersiz kılınamaz.

(Devralındığı yer: CollectionBase)
InnerList

Örnekteki öğelerin CollectionBase listesini içeren bir ArrayList alır.

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

Nesneyi koleksiyonda CodeDirective belirtilen dizinde alır veya ayarlar.

List

Örnekteki öğelerin CollectionBase listesini içeren bir IList alır.

(Devralındığı yer: CollectionBase)

Yöntemler

Add(CodeDirective)

Belirtilen CodeDirective nesneyi koleksiyona ekler.

AddRange(CodeDirective[])

Koleksiyonun CodeDirective sonuna bir nesne dizisi ekler.

AddRange(CodeDirectiveCollection)

Belirtilen CodeDirectiveCollection nesnenin içeriğini koleksiyonun sonuna ekler.

Clear()

Örnekteki CollectionBase tüm nesneleri kaldırır. Bu yöntem geçersiz kılınamaz.

(Devralındığı yer: CollectionBase)
Contains(CodeDirective)

Koleksiyonun belirtilen CodeDirective nesneyi içerip içermediğini belirten bir değer alır.

CopyTo(CodeDirective[], Int32)

Koleksiyonun içeriğini belirtilen dizinden başlayarak tek boyutlu bir diziye kopyalar.

Equals(Object)

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

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

Örnekte yineleyen CollectionBase bir numaralandırıcı döndürür.

(Devralındığı yer: CollectionBase)
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(CodeDirective)

Belirtilen nesne koleksiyonda varsa, dizinini belirtilen CodeDirective nesnenin koleksiyonunda alır.

Insert(Int32, CodeDirective)

Belirtilen nesneyi belirtilen CodeDirective dizindeki koleksiyona ekler.

MemberwiseClone()

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

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

Örneğin içeriğini CollectionBase temizlerken ek özel işlemler gerçekleştirir.

(Devralındığı yer: CollectionBase)
OnClearComplete()

Örneğin içeriğini CollectionBase temizledikten sonra ek özel işlemler gerçekleştirir.

(Devralındığı yer: CollectionBase)
OnInsert(Int32, Object)

Örneğe yeni bir öğe CollectionBase eklemeden önce ek özel işlemler gerçekleştirir.

(Devralındığı yer: CollectionBase)
OnInsertComplete(Int32, Object)

Örneğe yeni bir öğe CollectionBase ekledikten sonra ek özel işlemler gerçekleştirir.

(Devralındığı yer: CollectionBase)
OnRemove(Int32, Object)

Bir öğeyi örnekten CollectionBase kaldırırken ek özel işlemler gerçekleştirir.

(Devralındığı yer: CollectionBase)
OnRemoveComplete(Int32, Object)

Bir öğeyi örnekten CollectionBase kaldırdıktan sonra ek özel işlemler gerçekleştirir.

(Devralındığı yer: CollectionBase)
OnSet(Int32, Object, Object)

Örnekte bir değer CollectionBase ayarlamadan önce ek özel işlemler gerçekleştirir.

(Devralındığı yer: CollectionBase)
OnSetComplete(Int32, Object, Object)

Örnekte bir değer CollectionBase ayarladıktan sonra ek özel işlemler gerçekleştirir.

(Devralındığı yer: CollectionBase)
OnValidate(Object)

Bir değeri doğrularken ek özel işlemler gerçekleştirir.

(Devralındığı yer: CollectionBase)
Remove(CodeDirective)

Belirtilen CodeDirective nesneyi koleksiyondan kaldırır.

RemoveAt(Int32)

Örneğin belirtilen dizinindeki CollectionBase öğesini kaldırır. Bu yöntem geçersiz kılınamaz.

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

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

(Devralındığı yer: Object)

Belirtik Arabirim Kullanımları

ICollection.CopyTo(Array, Int32)

Hedef dizinin belirtilen dizininden başlayarak tamamını CollectionBase uyumlu bir tek boyutlu Arrayöğesine kopyalar.

(Devralındığı yer: CollectionBase)
ICollection.IsSynchronized

erişimin CollectionBase eşitlenip eşitlenmediğini belirten bir değer alır (iş parçacığı güvenli).

(Devralındığı yer: CollectionBase)
ICollection.SyncRoot

erişimi CollectionBaseeşitlemek için kullanılabilecek bir nesnesi alır.

(Devralındığı yer: CollectionBase)
IList.Add(Object)

sonuna bir nesnesi CollectionBaseekler.

(Devralındığı yer: CollectionBase)
IList.Contains(Object)

öğesinin CollectionBase belirli bir öğeyi içerip içermediğini belirler.

(Devralındığı yer: CollectionBase)
IList.IndexOf(Object)

Belirtilen Object öğesini arar ve tüm CollectionBaseiçindeki ilk oluşumun sıfır tabanlı dizinini döndürür.

(Devralındığı yer: CollectionBase)
IList.Insert(Int32, Object)

Belirtilen dizinde öğesine CollectionBase bir öğe ekler.

(Devralındığı yer: CollectionBase)
IList.IsFixedSize

değerinin sabit bir boyuta sahip olup olmadığını CollectionBase belirten bir değer alır.

(Devralındığı yer: CollectionBase)
IList.IsReadOnly

CollectionBase öğesinin salt okunur olup olmadığını belirten bir değer alır.

(Devralındığı yer: CollectionBase)
IList.Item[Int32]

Belirtilen dizindeki öğeyi alır veya ayarlar.

(Devralındığı yer: CollectionBase)
IList.Remove(Object)

belirli bir nesnenin ilk oluşumunu öğesinden CollectionBasekaldırır.

(Devralındığı yer: CollectionBase)

Uzantı Metotları

Cast<TResult>(IEnumerable)

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

OfType<TResult>(IEnumerable)

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

AsParallel(IEnumerable)

Sorgunun paralelleştirilmesini etkinleştirir.

AsQueryable(IEnumerable)

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

Şunlara uygulanır

Ayrıca bkz.