
{"id":518,"date":"2010-07-01T10:36:54","date_gmt":"2010-07-01T14:36:54","guid":{"rendered":"http:\/\/www.ikriv.com\/blog\/?p=518"},"modified":"2010-07-01T10:36:54","modified_gmt":"2010-07-01T14:36:54","slug":"wpf-is-clone-of-freezable-frozen","status":"publish","type":"post","link":"https:\/\/ikriv.com\/blog\/?p=518","title":{"rendered":"WPF: Is clone of Freezable frozen?"},"content":{"rendered":"<p>WPF defines a <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/system.windows.freezable.aspx\"><code>Freezable<\/code><\/a> type that is a base class for &#8220;almost immutable&#8221; objects. They can be setup in read\/write mode and then &#8220;frozen&#8221; which makes them immutable and thread safe.<\/p>\n<p>Freezables are also cloneable. If I make a clone of a Freezable, will it be frozen? Fortunately, it won&#8217;t, so I can modify the clone at will, and then freeze it if necessary. Here&#8217;s the passing unit test that proves that:<\/p>\n<pre><code>\n   [TestMethod]\n   public void ClonedFreezableIsNotFrozen()\n   {\n      var brush = new SolidColorBrush(Colors.Red);\n      brush.Freeze();\n      var clone = brush.Clone();\n      Assert.IsFalse(clone.IsFrozen);\n   }\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>WPF defines a Freezable type that is a base class for &#8220;almost immutable&#8221; objects. They can be setup in read\/write mode and then &#8220;frozen&#8221; which makes them immutable and thread <a href=\"https:\/\/ikriv.com\/blog\/?p=518\" class=\"more-link\">[&hellip;]<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"Layout":"","footnotes":""},"categories":[4,12],"tags":[],"class_list":["entry","author-ikriv","post-518","post","type-post","status-publish","format-standard","category-hack","category-wpf"],"_links":{"self":[{"href":"https:\/\/ikriv.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/518","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ikriv.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ikriv.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ikriv.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ikriv.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=518"}],"version-history":[{"count":0,"href":"https:\/\/ikriv.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/518\/revisions"}],"wp:attachment":[{"href":"https:\/\/ikriv.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=518"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ikriv.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=518"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ikriv.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=518"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}