Поскольку Dictionary
универсальный класс (Dictionary<TKey, TValue>
), так, чтобы доступ к его содержанию был безопасен с точки зрения типов (т.е. Вы не должны бросать от Object
, как Вы делаете с Hashtable
).
Выдерживают сравнение
var customers = new Dictionary<string, Customer>();
...
Customer customer = customers["Ali G"];
к
var customers = new Hashtable();
...
Customer customer = customers["Ali G"] as Customer;
Однако Dictionary
, реализован как хэш-таблица внутренне, так технически она работает тот же путь.
Может быть, это было бы проще реализовать в вашей ViewModel?
public string BillingAddress{
set{
billingAddress = value;
firePropertyChanged("BillingAddress");
if(string.isNullOrEmpty(ShippingAddress)
{
ShippingAddress = value; //use the property to ensure PropertyChanged fires
}
}
get{ return billingAddress; }
}