Re: How do you add content to a tab control dynamically in wcf -- at run time?

Originally Posted by
BigEd781
I am curious as to why you use a safe cast instead of an explicit cast when you are not che3cking for null afterward? Just wondering.
It bugs me just a little when I see people do that too. I guess it just comes down to which exception you want to hunt down null object or InvalidCast, either one provide about the same information I guess, but I prefer getting an InvalidCast if I made an invalid cast. Actually for most UI callbacks I use the as operator and then if it is null I return doing nothing but writing an error into the application log. My theory is whatever the user was trying to do was not going to work out to well anyway so I might as well just do nothing.
--------------------------------------------------------------------------------------------------------------------------
Disclaimer - Most likely any code I have posted as an answer was most likely written free hand and may have some minor compile errors, and is merely intended to give you the idea.