최종
using System;
using System.Collections.Generic;
namespace test2
{
class Program
{
static void Main(string[] args)
{
List<int> list1 = new List<int>(); //오른쪽을 왼쪽 list1 대입
List<string> list2 = new List<string>();//list후 tap키 누르면 string 선택됨
Dictionary<char, string> parasite = new Dictionary<char, string>()
{
{'a',"봉준호" },
{'b',"조여정" }
};
parasite.Add('c', "이선균"); //새로운 요소 추가 가능
Console.WriteLine(parasite['b']); //키값이 특정한 특성을 가지고 있는 지 확인하고 싶음
/* parasite.Remove('a') //새로운멤버 삭제 가능 키 값이 a인걸 삭제해라
Dictionary<int, string> parasite = new Dictionary<int, string>()
{
{1,"봉준호" },
{2,"조여정" }
};
list1.Add(1); //비어있는 앞자리에 1이 들어간것임
int[] x = { 2, 3, 4, 5 };
list1.AddRange(x); //add는 하나씩 넣는 거 addrange는 통채로 넣는 것
list1.Insert(1, 10); //중간에 넣을 떄 insert
list1.Remove(10); //item삭제
list1.Remove(0); //index
Console.WriteLine(list1.Count); //get은 읽기 쓰기 중 읽기 항목들의 개수를 알려줄것입니다. count라는 속성
foreach (var item in list1) // foreach 치고 tap tap 하면 자동완성 collection를 list1으로 변경
{
Console.WriteLine(item);
}
*/
}
}
}
'C#' 카테고리의 다른 글
C# age = (value > 0) ? value : age; (0) | 2021.07.23 |
---|---|
C# List Dictionary 예제 사과 딸기 (0) | 2021.07.23 |
test2 list클래스 예제 (0) | 2021.07.23 |
C# 주차장 요금계산 시스템 (0) | 2021.07.22 |
문자열 분리 (0) | 2021.07.22 |