BackEND/NetCore

자료형과 리스트

smartlittlepuppy 2021. 5. 1. 21:13
반응형

 

1) 기본자료형

 int, string, double(소수점이 포함된거), long(int 64), float

 

2) 사용자 정의

Class 객체

 

3) 자료형과 리스트

var list = List<T>( ); 

list.Add(new User { Name ="", birth = 930909 }...

 

#region + Non Generic collection example (ctrl + k + s), Comment( ctrl + k + c)
            //Non Generic Collection
            //ArrayList list = new ArrayList();

            //list.Add("DotNet");
            //list.Add(2.1);
            //list.Add("ASP.NET CoRE");

            //foreach (var item in list)
            //{
            //    Console.WriteLine(item);
            //}

            #endregion

            // Generic collection example
            var list2 = new List<int>(){  // 숫자를 담는 리스트
               1,2,3,4
            };
            IEnumerable<int> enumerableList = list2;
            Console.WriteLine(enumerableList.Count());
           


            Console.ReadLine();

 

 

 

 

반응형