Last time, I introduced the self-assignment principle for Windows Runtime properties:Setting a property to its current value is legal and has no effect.One corollary to this was that setting a property twice to the same value has no effect.A more interesting corollary is this one:The default value of a property must be a legal value.If the property value has never been changed from the default, then a self-assignment will assign the default value, and that must succeed.This second corollary can catch some people who submit API designs in which they propose something like this:The DoodadFinder class contains a collection of properties that you can set to narrow the search that occurs when you call Find(). If you want to find Doodads with a specific partner widget, you can set the DoodadOptions.PartnerWidget property to the handle of that partner widget. You may not set the PartnerWidget property to null.I ask them, "So if I create a brand new DoodadFinder object and immediately read the PartnerWidget property, what do I get?""Oh, since this is a brand new DoodadFinder object, no partner widget has been specified, so the PartnerWidget is null."I pointed out that this violates the "allow self-assignment" rule:var finder = new DoodadFinder();finder.PartnerWidget = finder.PartnerWidget; // throws InvalidArgumentException?You can say that a property may not be null, but you can't say that and simultaneously default the value to null. You're saying that the default value is illegal.The DoodadFinder should allow the PartnerWidget to be set to null if it is already null.Indeed, I think that they should allow it to be set back to null, so that there's a way to undo a prior set. As long as you undo it before calling Find(), then it should behave as if it had never been set.var finder = new DoodadFinder();ConfigureFinder(finder); // might set PartnerWidgetfinder.PartnerWidget = null; // cancel the partner widget filteror evenvoid ConfigureFinderButPreservePartnerWidget(DoodadFinder finder){ var originalPartner = finder.PartnerWidget; try { ConfigureFinder(finder); // might set the PartnerWidget } finally { finder.PartnerWidget = originalPartner; }}Next time, we'll look at another perhaps-surprising corollary to the self-assignment principle.