Geeks With Blogs
shmoolca wpf programming July 2009 Entries
Differences between casting and „as” keyword
Main difference is that casting to wrong type throw an exception and an “as” keyword just return null. So if I would like to search specified type in VisualTree I can use “as” keyword and check is object not null or I can use “is” keyword. But when I would like to take not reference object like generics KeyValuePair from object type I will have to use casting to unpack the value type. This is because value types do not inherit from object so they are not objects and cannot use keyword as.

Posted On Tuesday, July 14, 2009 5:52 PM

Not obvious method name
To get TemplateChild from DataTemplate use FindName method. In my opinion more adequate name is FindByName.

Posted On Tuesday, July 14, 2009 5:29 PM

Performance issue
If there is no need to change freezable object anymore, always remember to call freeze method.

Posted On Sunday, July 12, 2009 1:48 PM

Copyright © Anna Bauza | Powered by: GeeksWithBlogs.net