private void requireAccessAndNotDisposed() { #if !SILVERLIGHT VerifyAccess(); #endif BotUtil.ThrowUnless <ObjectDisposedException>(!m_disposed, "This object has been disposed"); }
public static void VerifyPropertyNamesOnChange(this INotifyPropertyChanged element) { Contract.Requires(element != null); var myType = element.GetType(); element.PropertyChanged += (sender, args) => { BotUtil.ThrowUnless <InvalidOperationException>(myType.HasPublicInstanceProperty(args.PropertyName), "The object '{0}' of type '{1}' raised a property change for '{2}' which isn't a public property on the type.".StringFormat(element, myType, args.PropertyName)); }; }