728x90
반응형
728x170
using System;
using System.ComponentModel;
/// <summary>
/// 학생
/// </summary>
public class Student
{
//////////////////////////////////////////////////////////////////////////////////////////////////// Property
////////////////////////////////////////////////////////////////////////////////////////// Public
#region 학번 - ID
/// <summary>
/// 학번
/// </summary>
public int ID { get; set; }
#endregion
#region 성명 - Name
/// <summary>
/// 성명
/// </summary>
public string Name { get; set; }
#endregion
#region 학년 - Grade
/// <summary>
/// 학년
/// </summary>
public int Grade { get; set; }
#endregion
}
...
Student student = new Student() { ID = 1, Name = "홍길동", Grade = 3 };
PropertyDescriptorCollection propertyDescriptorCollection = TypeDescriptor.GetProperties(student);
PropertyDescriptor propertyDescriptor = propertyDescriptorCollection["Name"];
Console.WriteLine(propertyDescriptor.GetValue(student));
728x90
반응형
그리드형(광고전용)
'C# > Common' 카테고리의 다른 글
[C#/COMMON] IEnumerator<T> 인터페이스 - 사용자 정의 반복기(Iterator) 사용하기 (0) | 2014.12.02 |
---|---|
[C#/COMMON] TypeDescriptionProvider 클래스 : 객체 구하기 (0) | 2014.12.02 |
[C#/COMMON] Activator 클래스 : CreateInstanceFrom 정적 메소드를 사용해 객체 구하기 (0) | 2014.12.02 |
[C#/COMMON] IEnumerator<T> 인터페이스 사용하기 (0) | 2014.12.01 |
[C#/COMMON] IEnumerator 인터페이스 사용하기 (0) | 2014.12.01 |
[C#/COMMON] PropertyDescriptor 클래스 : 속성 값 구하기 (0) | 2014.11.30 |
[C#/COMMON] 스무스 정렬하기 (0) | 2014.11.30 |
[C#/COMMON] 힙 정렬하기 (0) | 2014.11.30 |
[C#/COMMON] 쉘 정렬하기 (0) | 2014.11.30 |
[C#/COMMON] 삽입 정렬하기 (0) | 2014.11.30 |
[C#/COMMON] 퀵 정렬하기 (0) | 2014.11.30 |
댓글을 달아 주세요