[DebuggerDisplay("{OneLineAddress}")] をデバッガ プロキシのクラスで使用すると、動作しないようです。私が間違っていることはありますか?または、元のクラスにコードを追加せずにこれを回避する方法はありますか?
[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; }
}
}
}