NameObjectCollectionBase NameObjectCollectionBase NameObjectCollectionBase NameObjectCollectionBase Class

정의

키나 인덱스를 사용하여 액세스할 수 있는 연결된 String 키와 Object 값의 컬렉션에 대한 abstract 기본 클래스를 제공합니다.Provides the abstract base class for a collection of associated String keys and Object values that can be accessed either with the key or with the index.

public ref class NameObjectCollectionBase abstract : System::Collections::ICollection, System::Runtime::Serialization::IDeserializationCallback, System::Runtime::Serialization::ISerializable
[System.Serializable]
public abstract class NameObjectCollectionBase : System.Collections.ICollection, System.Runtime.Serialization.IDeserializationCallback, System.Runtime.Serialization.ISerializable
type NameObjectCollectionBase = class
    interface ICollection
    interface ISerializable
    interface IDeserializationCallback
    interface IEnumerable
Public MustInherit Class NameObjectCollectionBase
Implements ICollection, IDeserializationCallback, ISerializable
상속
NameObjectCollectionBaseNameObjectCollectionBaseNameObjectCollectionBaseNameObjectCollectionBase
파생
특성
구현

예제

다음 코드 예제에는 구현 및 사용 하는 방법을 보여 줍니다는 NameObjectCollectionBase 클래스입니다.The following code example shows how to implement and use the NameObjectCollectionBase class.

#using <System.dll>
using namespace System;
using namespace System::Collections;
using namespace System::Collections::Specialized;

public ref class MyCollection : public NameObjectCollectionBase  {

private:
   DictionaryEntry^ _de;

   // Creates an empty collection.
public:
   MyCollection()  {
      _de = gcnew DictionaryEntry();
   }

   // Adds elements from an IDictionary into the new collection.
   MyCollection( IDictionary^ d, Boolean bReadOnly )  {

      _de = gcnew DictionaryEntry();

      for each ( DictionaryEntry^ de in d )  {
         this->BaseAdd( (String^) de->Key, de->Value );
      }
      this->IsReadOnly = bReadOnly;
   }

   // Gets a key-and-value pair (DictionaryEntry) using an index.
   property DictionaryEntry^ default[ int ]  {
      DictionaryEntry^ get(int index)  {
         _de->Key = this->BaseGetKey(index);
         _de->Value = this->BaseGet(index);
         return( _de );
      }
   }

   // Gets or sets the value associated with the specified key.
   property Object^ default[ String^ ]  {
      Object^ get(String^ key)  {
         return( this->BaseGet( key ) );
      }
      void set( String^ key, Object^ value )  {
         this->BaseSet( key, value );
      }
   }

   // Gets a String array that contains all the keys in the collection.
   property array<String^>^ AllKeys  {
      array<String^>^ get()  {
         return( (array<String^>^)this->BaseGetAllKeys() );
      }
   }

   // Gets an Object array that contains all the values in the collection.
   property Array^ AllValues  {
      Array^ get()  {
         return( this->BaseGetAllValues() );
      }
   }

   // Gets a String array that contains all the values in the collection.
   property array<String^>^ AllStringValues  {
      array<String^>^ get()  {
         return( (array<String^>^) this->BaseGetAllValues(  String ::typeid ));
      }
   }

   // Gets a value indicating if the collection contains keys that are not null.
   property Boolean HasKeys  {
      Boolean get()  {
         return( this->BaseHasKeys() );
      }
   }

   // Adds an entry to the collection.
   void Add( String^ key, Object^ value )  {
      this->BaseAdd( key, value );
   }

   // Removes an entry with the specified key from the collection.
   void Remove( String^ key )  {
      this->BaseRemove( key );
   }

   // Removes an entry in the specified index from the collection.
   void Remove( int index )  {
      this->BaseRemoveAt( index );
   }

   // Clears all the elements in the collection.
   void Clear()  {
      this->BaseClear();
   }
};

public ref class SamplesNameObjectCollectionBase  {

public:
   static void Main()  {
      // Creates and initializes a new MyCollection that is read-only.
      IDictionary^ d = gcnew ListDictionary();
      d->Add( "red", "apple" );
      d->Add( "yellow", "banana" );
      d->Add( "green", "pear" );
      MyCollection^ myROCol = gcnew MyCollection( d, true );

      // Tries to add a new item.
      try  {
         myROCol->Add( "blue", "sky" );
      }
      catch ( NotSupportedException^ e )  {
         Console::WriteLine( e->ToString() );
      }

      // Displays the keys and values of the MyCollection.
      Console::WriteLine( "Read-Only Collection:" );
      PrintKeysAndValues( myROCol );

      // Creates and initializes an empty MyCollection that is writable.
      MyCollection^ myRWCol = gcnew MyCollection();

      // Adds new items to the collection.
      myRWCol->Add( "purple", "grape" );
      myRWCol->Add( "orange", "tangerine" );
      myRWCol->Add( "black", "berries" );
      Console::WriteLine( "Writable Collection (after adding values):" );
      PrintKeysAndValues( myRWCol );

      // Changes the value of one element.
      myRWCol["orange"] = "grapefruit";
      Console::WriteLine( "Writable Collection (after changing one value):" );
      PrintKeysAndValues( myRWCol );

      // Removes one item from the collection.
      myRWCol->Remove( "black" );
      Console::WriteLine( "Writable Collection (after removing one value):" );
      PrintKeysAndValues( myRWCol );

      // Removes all elements from the collection.
      myRWCol->Clear();
      Console::WriteLine( "Writable Collection (after clearing the collection):" );
      PrintKeysAndValues( myRWCol );
   }

   // Prints the indexes, keys, and values.
   static void PrintKeysAndValues( MyCollection^ myCol )  {
      for ( int i = 0; i < myCol->Count; i++ )  {
         Console::WriteLine( "[{0}] : {1}, {2}", i, myCol[i]->Key, myCol[i]->Value );
      }
   }

   // Prints the keys and values using AllKeys.
   static void PrintKeysAndValues2( MyCollection^ myCol )  {
      for each ( String^ s in myCol->AllKeys )  {
         Console::WriteLine( "{0}, {1}", s, myCol[s] );
      }
   }
};

int main()
{
    SamplesNameObjectCollectionBase::Main();
}

/*
This code produces the following output.

System.NotSupportedException: Collection is read-only.
   at System.Collections.Specialized.NameObjectCollectionBase.BaseAdd(String name, Object value)
   at SamplesNameObjectCollectionBase.Main()
Read-Only Collection:
[0] : red, apple
[1] : yellow, banana
[2] : green, pear
Writable Collection (after adding values):
[0] : purple, grape
[1] : orange, tangerine
[2] : black, berries
Writable Collection (after changing one value):
[0] : purple, grape
[1] : orange, grapefruit
[2] : black, berries
Writable Collection (after removing one value):
[0] : purple, grape
[1] : orange, grapefruit
Writable Collection (after clearing the collection):

*/
using System;
using System.Collections;
using System.Collections.Specialized;

public class MyCollection : NameObjectCollectionBase
{
   // Creates an empty collection.
   public MyCollection()  {
   }

   // Adds elements from an IDictionary into the new collection.
   public MyCollection( IDictionary d, Boolean bReadOnly )  {
      foreach ( DictionaryEntry de in d )  {
         this.BaseAdd( (String) de.Key, de.Value );
      }
      this.IsReadOnly = bReadOnly;
   }

   // Gets a key-and-value pair (DictionaryEntry) using an index.
   public DictionaryEntry this[ int index ]  {
      get  {
          return ( new DictionaryEntry( 
              this.BaseGetKey(index), this.BaseGet(index) ) );
      }
   }

   // Gets or sets the value associated with the specified key.
   public Object this[ String key ]  {
      get  {
         return( this.BaseGet( key ) );
      }
      set  {
         this.BaseSet( key, value );
      }
   }

   // Gets a String array that contains all the keys in the collection.
   public String[] AllKeys  {
      get  {
         return( this.BaseGetAllKeys() );
      }
   }

   // Gets an Object array that contains all the values in the collection.
   public Array AllValues  {
      get  {
         return( this.BaseGetAllValues() );
      }
   }

   // Gets a String array that contains all the values in the collection.
   public String[] AllStringValues  {
      get  {
         return( (String[]) this.BaseGetAllValues( typeof( string ) ));
      }
   }

   // Gets a value indicating if the collection contains keys that are not null.
   public Boolean HasKeys  {
      get  {
         return( this.BaseHasKeys() );
      }
   }

   // Adds an entry to the collection.
   public void Add( String key, Object value )  {
      this.BaseAdd( key, value );
   }

   // Removes an entry with the specified key from the collection.
   public void Remove( String key )  {
      this.BaseRemove( key );
   }

   // Removes an entry in the specified index from the collection.
   public void Remove( int index )  {
      this.BaseRemoveAt( index );
   }

   // Clears all the elements in the collection.
   public void Clear()  {
      this.BaseClear();
   }

}

public class SamplesNameObjectCollectionBase  {

   public static void Main()  {

      // Creates and initializes a new MyCollection that is read-only.
      IDictionary d = new ListDictionary();
      d.Add( "red", "apple" );
      d.Add( "yellow", "banana" );
      d.Add( "green", "pear" );
      MyCollection myROCol = new MyCollection( d, true );

      // Tries to add a new item.
      try  {
         myROCol.Add( "blue", "sky" );
      }
      catch ( NotSupportedException e )  {
         Console.WriteLine( e.ToString() );
      }

      // Displays the keys and values of the MyCollection.
      Console.WriteLine( "Read-Only Collection:" );
      PrintKeysAndValues( myROCol );


      // Creates and initializes an empty MyCollection that is writable.
      MyCollection myRWCol = new MyCollection();

      // Adds new items to the collection.
      myRWCol.Add( "purple", "grape" );
      myRWCol.Add( "orange", "tangerine" );
      myRWCol.Add( "black", "berries" );
      Console.WriteLine( "Writable Collection (after adding values):" );
      PrintKeysAndValues( myRWCol );

      // Changes the value of one element.
      myRWCol["orange"] = "grapefruit";
      Console.WriteLine( "Writable Collection (after changing one value):" );
      PrintKeysAndValues( myRWCol );

      // Removes one item from the collection.
      myRWCol.Remove( "black" );
      Console.WriteLine( "Writable Collection (after removing one value):" );
      PrintKeysAndValues( myRWCol );

      // Removes all elements from the collection.
      myRWCol.Clear();
      Console.WriteLine( "Writable Collection (after clearing the collection):" );
      PrintKeysAndValues( myRWCol );

   }

   // Prints the indexes, keys, and values.
   public static void PrintKeysAndValues( MyCollection myCol )  {
      for ( int i = 0; i < myCol.Count; i++ )  {
         Console.WriteLine( "[{0}] : {1}, {2}", i, myCol[i].Key, myCol[i].Value );
      }
   }

   // Prints the keys and values using AllKeys.
   public static void PrintKeysAndValues2( MyCollection myCol )  {
      foreach ( String s in myCol.AllKeys )  {
         Console.WriteLine( "{0}, {1}", s, myCol[s] );
      }
   }
}


/*
This code produces the following output.

System.NotSupportedException: Collection is read-only.
   at System.Collections.Specialized.NameObjectCollectionBase.BaseAdd(String name, Object value)
   at SamplesNameObjectCollectionBase.Main()
Read-Only Collection:
[0] : red, apple
[1] : yellow, banana
[2] : green, pear
Writable Collection (after adding values):
[0] : purple, grape
[1] : orange, tangerine
[2] : black, berries
Writable Collection (after changing one value):
[0] : purple, grape
[1] : orange, grapefruit
[2] : black, berries
Writable Collection (after removing one value):
[0] : purple, grape
[1] : orange, grapefruit
Writable Collection (after clearing the collection):

*/
Imports System
Imports System.Collections
Imports System.Collections.Specialized

Public Class MyCollection
   Inherits NameObjectCollectionBase

   ' Creates an empty collection.
   Public Sub New()
   End Sub 'New

   ' Adds elements from an IDictionary into the new collection.
   Public Sub New(d As IDictionary, bReadOnly As Boolean)
      Dim de As DictionaryEntry
      For Each de In  d
         Me.BaseAdd(CType(de.Key, String), de.Value)
      Next de
      Me.IsReadOnly = bReadOnly
   End Sub 'New

   ' Gets a key-and-value pair (DictionaryEntry) using an index.
   Default Public ReadOnly Property Item(index As Integer) As DictionaryEntry
      Get
            return new DictionaryEntry( _
                me.BaseGetKey(index), me.BaseGet(index) )
      End Get
   End Property

   ' Gets or sets the value associated with the specified key.
   Default Public Property Item(key As String) As Object
      Get
         Return Me.BaseGet(key)
      End Get
      Set
         Me.BaseSet(key, value)
      End Set
   End Property

   ' Gets a String array that contains all the keys in the collection.
   Public ReadOnly Property AllKeys() As String()
      Get
         Return Me.BaseGetAllKeys()
      End Get
   End Property

   ' Gets an Object array that contains all the values in the collection.
   Public ReadOnly Property AllValues() As Array
      Get
         Return Me.BaseGetAllValues()
      End Get
   End Property

   ' Gets a String array that contains all the values in the collection.
   Public ReadOnly Property AllStringValues() As String()
      Get
         Return CType(Me.BaseGetAllValues(GetType(String)), String())
      End Get
   End Property

   ' Gets a value indicating if the collection contains keys that are not null.
   Public ReadOnly Property HasKeys() As Boolean
      Get
         Return Me.BaseHasKeys()
      End Get
   End Property

   ' Adds an entry to the collection.
   Public Sub Add(key As String, value As Object)
      Me.BaseAdd(key, value)
   End Sub 'Add

   ' Removes an entry with the specified key from the collection.
   Overloads Public Sub Remove(key As String)
      Me.BaseRemove(key)
   End Sub 'Remove

   ' Removes an entry in the specified index from the collection.
   Overloads Public Sub Remove(index As Integer)
      Me.BaseRemoveAt(index)
   End Sub 'Remove

   ' Clears all the elements in the collection.
   Public Sub Clear()
      Me.BaseClear()
   End Sub 'Clear

End Class 'MyCollection


Public Class SamplesNameObjectCollectionBase   

   Public Shared Sub Main()

      ' Creates and initializes a new MyCollection that is read-only.
      Dim d As New ListDictionary()
      d.Add("red", "apple")
      d.Add("yellow", "banana")
      d.Add("green", "pear")
      Dim myROCol As New MyCollection(d, True)

      ' Tries to add a new item.
      Try
         myROCol.Add("blue", "sky")
      Catch e As NotSupportedException
         Console.WriteLine(e.ToString())
      End Try

      ' Displays the keys and values of the MyCollection.
      Console.WriteLine("Read-Only Collection:")
      PrintKeysAndValues(myROCol)

      ' Creates and initializes an empty MyCollection that is writable.
      Dim myRWCol As New MyCollection()

      ' Adds new items to the collection.
      myRWCol.Add("purple", "grape")
      myRWCol.Add("orange", "tangerine")
      myRWCol.Add("black", "berries")
      Console.WriteLine("Writable Collection (after adding values):")
      PrintKeysAndValues(myRWCol)

      ' Changes the value of one element.
      myRWCol("orange") = "grapefruit"
      Console.WriteLine("Writable Collection (after changing one value):")
      PrintKeysAndValues(myRWCol)

      ' Removes one item from the collection.
      myRWCol.Remove("black")
      Console.WriteLine("Writable Collection (after removing one value):")
      PrintKeysAndValues(myRWCol)

      ' Removes all elements from the collection.
      myRWCol.Clear()
      Console.WriteLine("Writable Collection (after clearing the collection):")
      PrintKeysAndValues(myRWCol)

   End Sub 'Main

   ' Prints the indexes, keys, and values.
   Public Shared Sub PrintKeysAndValues(myCol As MyCollection)
      Dim i As Integer
      For i = 0 To myCol.Count - 1
         Console.WriteLine("[{0}] : {1}, {2}", i, myCol(i).Key, myCol(i).Value)
      Next i
   End Sub 'PrintKeysAndValues

   ' Prints the keys and values using AllKeys.
   Public Shared Sub PrintKeysAndValues2(myCol As MyCollection)
      Dim s As String
      For Each s In  myCol.AllKeys
         Console.WriteLine("{0}, {1}", s, myCol(s))
      Next s
   End Sub 'PrintKeysAndValues2

End Class 'SamplesNameObjectCollectionBase


'This code produces the following output.
'
'System.NotSupportedException: Collection is read-only.
'   at System.Collections.Specialized.NameObjectCollectionBase.BaseAdd(String name, Object value)
'   at SamplesNameObjectCollectionBase.Main()
'Read-Only Collection:
'[0] : red, apple
'[1] : yellow, banana
'[2] : green, pear
'Writable Collection (after adding values):
'[0] : purple, grape
'[1] : orange, tangerine
'[2] : black, berries
'Writable Collection (after changing one value):
'[0] : purple, grape
'[1] : orange, grapefruit
'[2] : black, berries
'Writable Collection (after removing one value):
'[0] : purple, grape
'[1] : orange, grapefruit
'Writable Collection (after clearing the collection):

설명

이 클래스에 대 한 기본 구조는 해시 테이블입니다.The underlying structure for this class is a hash table.

각 요소는 키/값 쌍입니다.Each element is a key/value pair.

용량을 NameObjectCollectionBase 요소입니다는 NameObjectCollectionBase 보유할 수 있습니다.The capacity of a NameObjectCollectionBase is the number of elements the NameObjectCollectionBase can hold. 요소에 추가 되는 NameObjectCollectionBase, 용량을 자동으로 증가 하면 재할당을 통해 필요에 따라 합니다.As elements are added to a NameObjectCollectionBase, the capacity is automatically increased as required through reallocation.

키에 대 한 해시 코드를 분배 하는 해시 코드 공급자는 NameObjectCollectionBase 인스턴스.The hash code provider dispenses hash codes for keys in the NameObjectCollectionBase instance. 기본 해시 코드 공급자는 CaseInsensitiveHashCodeProvider합니다.The default hash code provider is the CaseInsensitiveHashCodeProvider.

두 키가 같은지 여부를 결정 하는 비교자입니다.The comparer determines whether two keys are equal. 기본 비교자는는 CaseInsensitiveComparer합니다.The default comparer is the CaseInsensitiveComparer.

.NET Framework 버전 1.0에서이 클래스는 문화권 구분 문자열 비교를 사용합니다.In .NET Framework version 1.0, this class uses culture-sensitive string comparisons. 그러나.NET framework 버전 1.1 이상에서이 클래스는 CultureInfo.InvariantCulture 문자열을 비교할 때.However, in .NET Framework version 1.1 and later, this class uses CultureInfo.InvariantCulture when comparing strings. 문화권 비교 및 정렬에 미치는 영향에 대 한 자세한 내용은 참조 하세요. 문화권 구분 문자열 작업 수행합니다.For more information about how culture affects comparisons and sorting, see Performing Culture-Insensitive String Operations.

null 키 또는 값으로 허용 됩니다.null is allowed as a key or as a value.

주의

합니다 BaseGet 메서드를 구분 하지 않습니다 null 지정된 된 키를 찾을 수 없으므로 반환 되는 및 null 키를 사용 하 여 연결 된 값 이므로 반환 되는 null합니다.The BaseGet method does not distinguish between null which is returned because the specified key is not found and null which is returned because the value associated with the key is null.

생성자

NameObjectCollectionBase() NameObjectCollectionBase() NameObjectCollectionBase() NameObjectCollectionBase()

비어 있는 NameObjectCollectionBase 클래스의 새 인스턴스를 초기화합니다.Initializes a new instance of the NameObjectCollectionBase class that is empty.

NameObjectCollectionBase(IEqualityComparer) NameObjectCollectionBase(IEqualityComparer) NameObjectCollectionBase(IEqualityComparer) NameObjectCollectionBase(IEqualityComparer)

기본 초기 용량을 갖고 있고 지정된 NameObjectCollectionBase 개체를 사용하는 비어 있는 IEqualityComparer 클래스의 새 인스턴스를 초기화합니다.Initializes a new instance of the NameObjectCollectionBase class that is empty, has the default initial capacity, and uses the specified IEqualityComparer object.

NameObjectCollectionBase(IHashCodeProvider, IComparer) NameObjectCollectionBase(IHashCodeProvider, IComparer) NameObjectCollectionBase(IHashCodeProvider, IComparer) NameObjectCollectionBase(IHashCodeProvider, IComparer)

기본 초기 용량을 갖고 있고 지정된 해시 코드 공급자와 지정된 비교자를 사용하는 비어 있는 NameObjectCollectionBase 클래스의 새 인스턴스를 초기화합니다.Initializes a new instance of the NameObjectCollectionBase class that is empty, has the default initial capacity, and uses the specified hash code provider and the specified comparer.

NameObjectCollectionBase(Int32) NameObjectCollectionBase(Int32) NameObjectCollectionBase(Int32) NameObjectCollectionBase(Int32)

지정된 초기 용량을 갖고 있고 기본 해시 코드 공급자와 기본 비교자를 사용하는 비어 있는 NameObjectCollectionBase 클래스의 새 인스턴스를 초기화합니다.Initializes a new instance of the NameObjectCollectionBase class that is empty, has the specified initial capacity, and uses the default hash code provider and the default comparer.

NameObjectCollectionBase(Int32, IEqualityComparer) NameObjectCollectionBase(Int32, IEqualityComparer) NameObjectCollectionBase(Int32, IEqualityComparer) NameObjectCollectionBase(Int32, IEqualityComparer)

지정된 초기 용량을 갖고 있고 지정된 NameObjectCollectionBase 개체를 사용하는 비어 있는 IEqualityComparer 클래스의 새 인스턴스를 초기화합니다.Initializes a new instance of the NameObjectCollectionBase class that is empty, has the specified initial capacity, and uses the specified IEqualityComparer object.

NameObjectCollectionBase(Int32, IHashCodeProvider, IComparer) NameObjectCollectionBase(Int32, IHashCodeProvider, IComparer) NameObjectCollectionBase(Int32, IHashCodeProvider, IComparer) NameObjectCollectionBase(Int32, IHashCodeProvider, IComparer)

비어 있는 상태이고 지정된 초기 용량을 가지며 지정된 해시 코드 공급자와 지정된 비교자를 사용하는 NameObjectCollectionBase 클래스의 새 인스턴스를 초기화합니다.Initializes a new instance of the NameObjectCollectionBase class that is empty, has the specified initial capacity and uses the specified hash code provider and the specified comparer.

NameObjectCollectionBase(SerializationInfo, StreamingContext) NameObjectCollectionBase(SerializationInfo, StreamingContext) NameObjectCollectionBase(SerializationInfo, StreamingContext) NameObjectCollectionBase(SerializationInfo, StreamingContext)

직렬화할 수 있으며 지정된 SerializationInfoStreamingContext를 사용하는 NameObjectCollectionBase 클래스의 새 인스턴스를 초기화합니다.Initializes a new instance of the NameObjectCollectionBase class that is serializable and uses the specified SerializationInfo and StreamingContext.

속성

Count Count Count Count

NameObjectCollectionBase 인스턴스에 포함된 키/값 쌍의 수를 가져옵니다.Gets the number of key/value pairs contained in the NameObjectCollectionBase instance.

IsReadOnly IsReadOnly IsReadOnly IsReadOnly

NameObjectCollectionBase 인스턴스가 읽기 전용인지 여부를 나타내는 값을 가져오거나 설정합니다.Gets or sets a value indicating whether the NameObjectCollectionBase instance is read-only.

Keys Keys Keys Keys

NameObjectCollectionBase.KeysCollection 인스턴스의 키를 모두 포함하는 NameObjectCollectionBase 인스턴스를 가져옵니다.Gets a NameObjectCollectionBase.KeysCollection instance that contains all the keys in the NameObjectCollectionBase instance.

메서드

BaseAdd(String, Object) BaseAdd(String, Object) BaseAdd(String, Object) BaseAdd(String, Object)

지정한 키와 값을 가지는 엔트리를 NameObjectCollectionBase 인스턴스에 추가합니다.Adds an entry with the specified key and value into the NameObjectCollectionBase instance.

BaseClear() BaseClear() BaseClear() BaseClear()

NameObjectCollectionBase 인스턴스에서 모든 엔트리를 제거합니다.Removes all entries from the NameObjectCollectionBase instance.

BaseGet(Int32) BaseGet(Int32) BaseGet(Int32) BaseGet(Int32)

NameObjectCollectionBase 인스턴스의 지정한 인덱스에서 엔트리의 값을 가져옵니다.Gets the value of the entry at the specified index of the NameObjectCollectionBase instance.

BaseGet(String) BaseGet(String) BaseGet(String) BaseGet(String)

NameObjectCollectionBase 인스턴스에서 지정한 키를 갖는 첫 번째 엔트리 값을 가져옵니다.Gets the value of the first entry with the specified key from the NameObjectCollectionBase instance.

BaseGetAllKeys() BaseGetAllKeys() BaseGetAllKeys() BaseGetAllKeys()

NameObjectCollectionBase 인스턴스의 모든 키를 포함하는 String 배열을 반환합니다.Returns a String array that contains all the keys in the NameObjectCollectionBase instance.

BaseGetAllValues() BaseGetAllValues() BaseGetAllValues() BaseGetAllValues()

NameObjectCollectionBase 인스턴스의 모든 값을 포함하는 Object 배열을 반환합니다.Returns an Object array that contains all the values in the NameObjectCollectionBase instance.

BaseGetAllValues(Type) BaseGetAllValues(Type) BaseGetAllValues(Type) BaseGetAllValues(Type)

NameObjectCollectionBase 인스턴스의 모든 값을 포함하는 지정한 형식의 배열을 반환합니다.Returns an array of the specified type that contains all the values in the NameObjectCollectionBase instance.

BaseGetKey(Int32) BaseGetKey(Int32) BaseGetKey(Int32) BaseGetKey(Int32)

NameObjectCollectionBase 인스턴스의 지정한 인덱스에서 엔트리의 키를 가져옵니다.Gets the key of the entry at the specified index of the NameObjectCollectionBase instance.

BaseHasKeys() BaseHasKeys() BaseHasKeys() BaseHasKeys()

NameObjectCollectionBase 인스턴스에 null이 아닌 키를 갖는 엔트리가 있는지 여부를 나타내는 값을 가져옵니다.Gets a value indicating whether the NameObjectCollectionBase instance contains entries whose keys are not null.

BaseRemove(String) BaseRemove(String) BaseRemove(String) BaseRemove(String)

NameObjectCollectionBase 인스턴스에서 지정한 키를 가지는 엔트리를 제거합니다.Removes the entries with the specified key from the NameObjectCollectionBase instance.

BaseRemoveAt(Int32) BaseRemoveAt(Int32) BaseRemoveAt(Int32) BaseRemoveAt(Int32)

NameObjectCollectionBase 인스턴스의 지정한 인덱스에서 엔트리를 제거합니다.Removes the entry at the specified index of the NameObjectCollectionBase instance.

BaseSet(Int32, Object) BaseSet(Int32, Object) BaseSet(Int32, Object) BaseSet(Int32, Object)

NameObjectCollectionBase 인스턴스의 지정한 인덱스에서 엔트리의 값을 설정합니다.Sets the value of the entry at the specified index of the NameObjectCollectionBase instance.

BaseSet(String, Object) BaseSet(String, Object) BaseSet(String, Object) BaseSet(String, Object)

지정한 키를 갖는 엔트리가 NameObjectCollectionBase 인스턴스에 있으면 첫 번째 엔트리의 값을 설정하고, 그러지 않으면 지정한 키와 값을 갖는 엔트리를 NameObjectCollectionBase 인스턴스에 추가합니다.Sets the value of the first entry with the specified key in the NameObjectCollectionBase instance, if found; otherwise, adds an entry with the specified key and value into the NameObjectCollectionBase instance.

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

지정한 개체와 현재 개체가 같은지 여부를 확인합니다.Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetEnumerator() GetEnumerator() GetEnumerator() GetEnumerator()

NameObjectCollectionBase를 반복하는 열거자를 반환합니다.Returns an enumerator that iterates through the NameObjectCollectionBase.

GetHashCode() GetHashCode() GetHashCode() GetHashCode()

기본 해시 함수로 작동합니다.Serves as the default hash function.

(Inherited from Object)
GetObjectData(SerializationInfo, StreamingContext) GetObjectData(SerializationInfo, StreamingContext) GetObjectData(SerializationInfo, StreamingContext) GetObjectData(SerializationInfo, StreamingContext)

ISerializable 인터페이스를 구현하고 NameObjectCollectionBase 인스턴스를 직렬화하는 데 필요한 데이터를 반환합니다.Implements the ISerializable interface and returns the data needed to serialize the NameObjectCollectionBase instance.

GetType() GetType() GetType() GetType()

현재 인스턴스의 Type을 가져옵니다.Gets the Type of the current instance.

(Inherited from Object)
MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

현재 Object의 단순 복사본을 만듭니다.Creates a shallow copy of the current Object.

(Inherited from Object)
OnDeserialization(Object) OnDeserialization(Object) OnDeserialization(Object) OnDeserialization(Object)

ISerializable 인터페이스를 구현하고, deserialization이 완료되면 deserialization 이벤트를 발생시킵니다.Implements the ISerializable interface and raises the deserialization event when the deserialization is complete.

ToString() ToString() ToString() ToString()

현재 개체를 나타내는 문자열을 반환합니다.Returns a string that represents the current object.

(Inherited from Object)

명시적 인터페이스 구현

ICollection.CopyTo(Array, Int32) ICollection.CopyTo(Array, Int32) ICollection.CopyTo(Array, Int32) ICollection.CopyTo(Array, Int32)

대상 배열의 지정된 인덱스에서 시작하여 전체 NameObjectCollectionBase을 호환되는 1차원 Array에 복사합니다.Copies the entire NameObjectCollectionBase to a compatible one-dimensional Array, starting at the specified index of the target array.

ICollection.IsSynchronized ICollection.IsSynchronized ICollection.IsSynchronized ICollection.IsSynchronized

NameObjectCollectionBase 개체에 대한 액세스가 동기화되어 스레드로부터 안전하게 보호되는지 여부를 나타내는 값을 가져옵니다.Gets a value indicating whether access to the NameObjectCollectionBase object is synchronized (thread safe).

ICollection.SyncRoot ICollection.SyncRoot ICollection.SyncRoot ICollection.SyncRoot

NameObjectCollectionBase 개체에 대한 액세스를 동기화하는 데 사용할 수 있는 개체를 가져옵니다.Gets an object that can be used to synchronize access to the NameObjectCollectionBase object.

Extension Methods

Cast<TResult>(IEnumerable) Cast<TResult>(IEnumerable) Cast<TResult>(IEnumerable) Cast<TResult>(IEnumerable)

IEnumerable의 요소를 지정된 형식으로 캐스팅합니다.Casts the elements of an IEnumerable to the specified type.

OfType<TResult>(IEnumerable) OfType<TResult>(IEnumerable) OfType<TResult>(IEnumerable) OfType<TResult>(IEnumerable)

지정된 형식에 따라 IEnumerable의 요소를 필터링합니다.Filters the elements of an IEnumerable based on a specified type.

AsParallel(IEnumerable) AsParallel(IEnumerable) AsParallel(IEnumerable) AsParallel(IEnumerable)

쿼리를 병렬화할 수 있도록 합니다.Enables parallelization of a query.

AsQueryable(IEnumerable) AsQueryable(IEnumerable) AsQueryable(IEnumerable) AsQueryable(IEnumerable)

변환를 IEnumerableIQueryable합니다.Converts an IEnumerable to an IQueryable.

적용 대상

스레드 보안

공용 정적 (Shared Visual Basic의)이 형식의 멤버는 스레드로부터 안전 합니다.Public static (Shared in Visual Basic) members of this type are thread safe. 인터페이스 멤버는 스레드로부터 안전하지 않습니다.Any instance members are not guaranteed to be thread safe.

이 구현은 동기화를 제공 하지 않습니다 스레드로부터 안전한 래퍼를 NameObjectCollectionBase, 파생된 클래스의 자체 동기화 된 버전을 만들 수 있지만 NameObjectCollectionBase 사용 하 여를 SyncRoot 속성.This implementation does not provide a synchronized (thread safe) wrapper for a NameObjectCollectionBase, but derived classes can create their own synchronized versions of the NameObjectCollectionBase using the SyncRoot property.

컬렉션을 열거 되지 본질적으로 스레드로부터 안전한 프로시저가 있습니다.Enumerating through a collection is intrinsically not a thread safe procedure. 컬렉션이 동기화되어 있을 때 다른 스레드에서 해당 컬렉션을 수정할 수 있으므로 이렇게 되면 열거자에서 예외가 throw됩니다.Even when a collection is synchronized, other threads can still modify the collection, which causes the enumerator to throw an exception. 열거하는 동안 스레드로부터 안전을 보장하려면 전체 열거를 수행하는 동안 컬렉션을 잠그거나 다른 스레드에서 변경된 내용으로 인해 발생한 예외를 catch하면 됩니다.To guarantee thread safety during enumeration, you can either lock the collection during the entire enumeration or catch the exceptions resulting from changes made by other threads.

추가 정보