어떤 이유로 반사를 사용하려고하는데이 문제가 발생했습니다.C# 반사 문제
class Service
{
public int ID {get; set;}
.
.
.
}
class CustomService
{
public Service srv {get; set;}
.
.
.
}
//main code
Type type = Type.GetType(typeof(CustomService).ToString());
PropertyInfo pinf = type.GetProperty("Service.ID"); // returns null
내 문제는 내가 주요 개체의 또 다른 특성 내부 때에 프로퍼티를 얻고 싶은 것입니다. 이 목표에 대한 간단한 방법이 있습니까?
미리 감사드립니다.
typeof (CustomService) 대신 Type.GetType (typeof (CustomService) .ToString()) 이유는 무엇입니까? –