이 엔티티 (클래스) 집합이있는 경우 :
Employee, Department, Room ... etc
개체 목록 대신 목록에 이러한 클래스 를 추가하는 방법 :
이렇게 :
{Employee, Department, Room}
나는 다음과 같은 서명을 가진 메소드를 가지고 있기 때문에이 클래스들을 얻길 원한다.
AuditManager.DefaultConfiguration.Exclude<T>();
그래서 어떻게 클래스 목록을 반복하고이 메서드에 전달하는 예 :
AuditManager.DefaultConfiguration.Exclude<Employee>();
쉬운:
List<Type> types = new List<Type> {typeof(Employee), typeof(Department), typeof(Room)};
또는 기존 객체에서 유형을 가져올 수 있습니다.
List<Type> types = new List<Type> {EmployeeInstance.GetType(), DepartmentInstance.GetType(), RoomInstance.GetType()};
나는 Employee
와 typeof(Employee)
차이를 설명하려고 노력할 것이지만 이 링크를 더 잘 읽는다 :
직원 은 데이터 계약 과 같습니다. X, Y와 같은 필드가 있습니다.
typeof (Employee) 는 사용자 의 '계약'유형이며 필드에 대한 정보가 있습니다. X 및 Y 필드에 대한 설명이 들어있는 정보입니다.