Alex Rivera | Logout

Why is Font immutable?

Asked 2009-10-13T15:49:11.700
11

Font being immutable distresses both the programmer and the GC, because you need to create a new instance every time.

Why is Font an immutable reference type then?

Edit
Report

1 Answer

8

They aren't structures because they need to have finalizers to wrap the underlying objects and provide a sensible IDisposable implementation. What happens if you Dispose() your own copy of a struct? Do you clone the handle each time?

It isn't really much stress on the GC...

It also allows the Font to be re-used safely without worry about it changing half way through an operation ;-p

answered 2009-10-13T15:53:50.253

Your Answer