Blog Content

  • 72.C# - 리스트 제네릭 클래스 ( List Generic Class)

    Category C# on 2009. 8. 18. 00:29

    네임스페이스인 System.Collections.Generic; 를 선언하게 되면 리스트 제네릭 을 사용할 수 있습니다. 리스트 제네릭 클래스는 어떠한 자료 형태도 다 받아 드릴 수 있어 코드의 간결화로 개발자 입장에서는 유용한 클래스 입니다.사용-예)ArrayList를 대신해서 사용 Program.cs using System; using System.Collections.Generic; public class 리스트제네릭클래스 { static void Main() { //정수형 List su = new List(); su.Add(10); su.Add(20); su.Add(30); for (int i = 0; i < su.Count; i++) { Console.WriteLine("{0}",su[i]); ..

    Read more
  • 40.C# - List<T> (리스트 제네릭 클래스)

    Category C# on 2009. 8. 10. 22:14

    리스트 제네릭 클래스는 using System.Collections.Generic 선언 후 사용합니다. List는 제네릭 클래스는 필요한 형식만을 받아 저장하는 형식입니다. 인덱스로 엑시스 할 수 있는 형식으로 개체 목록을 나타내며, 목록에서 검색, 정렬 및 조작을 사용 가능하도록 메서드를 제공하고 있습니다. ArrayList는 object형 값을 받습니다. (정수형만 필요해도 object) using System; using System.Collections.Generic; public class ListSample { public static void Main(string[] args) { //List 클래스의 인스턴스 생성 List lst = new List(); //Add(), Remove()등은..

    Read more
이전 1 다음