디버거 프록시 클래스에서 [DebuggerDisplay ("{OneLineAddress}")]를 사용하면 작동하지 않는 것 같습니다. 내가 뭘 잘못하고 있니? 또는 원래 클래스에 코드를 추가하지 않고이 문제를 해결할 수 있습니까?DebuggerTypeProxy 클래스의 DebuggerDisplay 특성
[DebuggerTypeProxy(typeof(AddressProxy))]
class Address
{
public int Number { get; set; }
public string Street { get; set; }
public string City { get; set; }
public string State { get; set; }
public int Zip { get; set; }
public Address(int number, string street, string city, string state, int zip)
{
Number = number;
Street = street;
City = city;
State = state;
Zip = zip;
}
[DebuggerDisplay("{OneLineAddress}")] // doesn't seem to work on proxy
private class AddressProxy
{
[DebuggerBrowsableAttribute(DebuggerBrowsableState.Never)]
private Address _internalAddress;
public AddressProxy(Address internalAddress)
{
_internalAddress = internalAddress;
}
public string OneLineAddress
{
get { return _internalAddress.Number + " " + _internalAddress.Street + " " + _internalAddress.City + " " + _internalAddress.State + " " + _internalAddress.Zip; }
}
}
}
그래,하지만 실제로 원하는 것은 DebuggerDisplay의 Proxy 클래스에서 일부 속성을 읽는 것입니다. – playerone