본문 바로가기
반응형

C#61

[C#] BitArray BitArray 클래스 BitArray 클래스 (System.Collections) 부울로 나타나는 간단한 비트 값 배열을 관리합니다. 여기에서 true는 비트가 설정(1)되었음을 나타내고 false는 비트가 해제(0)되었음을 나타냅니다. learn.microsoft.com - bool 값을 빽빽하게 저장하는 컬렉션 - 컬렉션 크기의 동적 변경을 지원 - bool 값 하나당 1바이트가 아닌 1비트만을 사용하므로 저장 공간을 효율적으로 이용함 namespace System.Collections { public sealed class BitArray : ICollection, IEnumerable, ICloneable { // 생성자 public BitArray(int length); // 비트의 수 설정,.. 2023. 9. 14.
[C#] Queue<T>, Queue, Stack<T>, Stack Queue 클래스 Queue 클래스 (System.Collections.Generic) 개체의 선입선출(FIFO) 컬렉션을 나타냅니다. learn.microsoft.com - 선입선출(FIFO; first-in, first-out) 방식의 대기열(Queue) 자료구조를 나타내는 클래스 - 색인으로 특정 요소에 직접 접근할 수 없기에 IList 와 IList를 구현하지 않음 * 임의 접근이 필요하면 ToArray 메서드를 통해 배열에 복사하여 사용 - 대기열은 내부적으로 배열로 구현됨 * 요소를 담을 공간이 부족해지면 대기열은 내부 배열을 더 큰 배열로 대체 * 삽입, 삭제 연산은 효율적(단 삽입으로 인해 크기가 변하지 않을 경우) namespace System.Collections.Generic { pu.. 2023. 9. 12.
[C#] LinkedList<T>, LinkedListNode<T> LinkedList 클래스 LinkedList 클래스 (System.Collections.Generic) 이중 연결 목록을 나타냅니다. learn.microsoft.com - 이중 연결 목록(Doubly Linked List; 이중으로 연결된 목록) 자료 구조를 나타내는 제네릭 클래스 - 새 요소를 목록의 어디에나 빠르게 삽입 할 수 있음 - 색인을 통해서 직접 접근하지 못하기 때문에 검색은 느림, 이진 탐색 역시 불가 - 색인 접근이 불가능하므로 IList는 구현하지 않음 namespace System.Collections.Generic { public class LinkedList : ICollection, IEnumerable, IEnumerable, ICollection, IReadOnlyColl.. 2023. 9. 10.
[C#] IList<T>, IList IList 인터페이스 IList 인터페이스 (System.Collections.Generic) 개별적으로 인덱스에 의해 액세스될 수 있는 개체의 컬렉션을 나타냅니다. learn.microsoft.com public interface IList : ICollection, IEnumerable, IEnumerable { // 인덱서를 통해 특정 위치의 요소를 읽고 씀 T this[int index] { get; set; } // 선형(linear search)를 이용해서 목록의 특정 요소에 접근 // 지정된 요소를 찾지 못하면 -1 int IndexOf(T item); // 요소 삽입 void Insert(int index, T item); // 요소 제거 void RemoveAt(int index); } .. 2023. 9. 8.
반응형