아래의 모든 public 속성을 가져 오려고합니다. 는 .NET 프레임 워크에서 나는 PropertyInfo
유형에서 IsPublic
을 사용하여 해당에 거라고하지만 그건 2..NET Core 2.0의 PropertyInfo.IsPublic과 같습니다.
internal class TestViewModel
{
public string PropertyOne { get; set; }
public string PropertyTwo { get; set; }
}
//how can I retrieve an IEnumerable with PropertyOne and PropertyTwo ONLY?
var type = typeof(TestViewModel);
var properties = type.GetProperties().Where(p => /*p.IsPublic &&*/ !p.IsSpecialName);
@mjwills하지 중복 다른 유형을 얻을 수 있습니다. – NullBy7e
@mjwills 저는 여기서 잘못했습니다. 나는 질문을 편집하고 더 명확하게했습니다. – NullBy7e