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();

 

 

 

 

반응형

'BackEND > NetCore' 카테고리의 다른 글

Where절, OrderBy  (0) 2021.05.04
Select, Insert, Update, Delete문  (0) 2021.05.04
뷰모델  (0) 2021.02.15
TagHelper, asp-validation-for  (0) 2020.12.13
유효성체크 Bind사용법  (0) 2020.12.01