첨부 실행 코드는 나눔고딕코딩 폰트를 사용합니다.
728x90
반응형
728x170

▶ Student.cs

namespace TestProject
{
    /// <summary>
    /// 학생
    /// </summary>
    public class Student
    {
        //////////////////////////////////////////////////////////////////////////////////////////////////// Property
        ////////////////////////////////////////////////////////////////////////////////////////// Public

        #region 성명 - Name

        /// <summary>
        /// 성명
        /// </summary>
        public string Name { get; set; }

        #endregion
        #region 나이 - Age

        /// <summary>
        /// 나이
        /// </summary>
        public int Age { get; set; }

        #endregion
    }
}

 

728x90

 

▶ Program.cs

using System;
using System.Collections.Generic;
using System.Data;
using System.Linq.Dynamic;

namespace TestProject
{
    /// <summary>
    /// 프로그램
    /// </summary>
    class Program
    {
        //////////////////////////////////////////////////////////////////////////////////////////////////// Method
        ////////////////////////////////////////////////////////////////////////////////////////// Static
        //////////////////////////////////////////////////////////////////////////////// Private

        #region 프로그램 시작하기 - Main()

        /// <summary>
        /// 프로그램 시작하기
        /// </summary>
        private static void Main()
        {
            List<Student> list = new List<Student>();

            list.Add(new Student { Name = "홍길동", Age = 20 });
            list.Add(new Student { Name = "김영희", Age = 30 });
            list.Add(new Student { Name = "이동수", Age = 20 });
            list.Add(new Student { Name = "강동원", Age = 50 });

            foreach(Student student in list.Where("Age > 20"))
            {
                Console.WriteLine(student.Name);
            }
        }

        #endregion
    }
}
728x90
반응형
그리드형(광고전용)
Posted by icodebroker

댓글을 달아 주세요