What happened
We replaced the static ViewShortcut.Empty field with a property and marked it as obsolete. The Empty property now always returns a new ViewShortcut object. Also, we added a new read-only Boolean IsEmpty property that should be used to check if a given view shortcut is empty.
Why we did this
The static ViewShortcut.Empty field was initialized with an empty ViewShortcut object. Since this object is a regular dictionary, it can be modified in one place and the change will affect the application behavior in other places, unpredictably. Moreover, when this shared object is accessed from different threads (for example, in a Web application), the application may crash.
How to update your application
The Empty field could be used in the following scenarios.
- In a condition that compares ViewShortcut.Empty with another view shortcut to check if the latter is empty. Replace this comparison with the ViewShortcut.IsEmpty property check.
- To get an empty ViewShortcut object. Use the ViewShortcut() constructor to create a new empty ViewShortcut object instead.