April 2009 Blog Posts

VSTO Data Caching

I spent more hours than I’d like figuring out why data caching didn’t work for me in a Word-based VSTO solution.  I did what I needed to implement a cached property: Public property Marked with Cached attribute Type to be cached marked as Serializable I saved the document on closing (after writing to the cached field), yet no luck.  After messing around for some time, I finally decided to test out serializing the type.  Since it’s specifically XML serialization that must succeed I used the XmlSerializer object, wrote...

Language Features: Variable Arguments

In a recent project I decided to use variable arguments to a function – the first time I’ve needed to.  If you haven’t worked with them before, you probably don’t know the point of them.  They’re easy to use though. Every so often you may need to pass a number of arguments to a function, but it may be hard to predict how many.  An example is the String.Format() method: String.Format("{0:d} - {1} ({2})", DateTime.Now, msg, severity); You could pass more or less arguments depending on what you are formatting.  If you’ve ever given it a thought, though, you’d...

«April»
SunMonTueWedThuFriSat
2930311234
567891011
12131415161718
19202122232425
262728293012
3456789