You cannot use the Freezable type in System.Windows outside of WPF.
The reason for this is that you are creating a dependency on WindowBase.dll (or where Freezable is defined). And such a link should not exist in "model projects" without direct access to the user interface.
However, you can easily create your own Freezable base class.
I used the following interface in an application where I wanted to create thread-safe objects that required complex initiation (these were circular links):
public interface IFreezable
{
bool CanFreeze
{
get;
}
bool IsFrozen
{
get;
}
void Freeze();
}
Pay attention to the CanFreeze property: I decided to use it because I wanted to test Freezables before freezing - and without giving the client a chance to do this, it is not good, in my opinion.
The Freezables concept is IMO a good idea that enriches the tool palette in multi-threaded applications.
source
share