Browse by Tags
All Tags »
C# »
API Design (RSS)
One of the more frequent questions I answer on StackOverflow is a variation of the following. I’m doing XXX with a file, how can I know if the file exists? The variations include verify no one else has the file open, if the file is in use, the file
Read More...
When using an API you must take care to understand not only what it returns, but also for how long the data returned will be valid. This is very important to consider because programs must make either be making decisions on valid and predictable
Read More...
I’ve recently run across several APIs that have a dependency on only dealing with objects that are serializable (in the binary sense). Unfortunately determining if an object is serializable is a non-trivial task and rife with problems. These
Read More...
Recently I ran into a situation on a personal project where I needed a hashtable like structure for a set of WeakReference values. When poking around for an existing implementation I saw found several versions which were very thin, type safe wrapper
Read More...
In my last post we discussed the problems with designing a safer API for mutable thread safe collections that employ only an internal locking system. The result was an API that was more difficult to mess up, yet pretty much unusable. Lets take a look
Read More...
Writing a collection which is mutable, thread safe and usable is an extremely difficult process. At least that’s what you’ve likely been told all through your schooling. But then you get out on the web and see a multitude of thread safe lists, maps and
Read More...
In responding to a recent blog post , one of the readers, Jeremy Gray, noted that I was using a NotImplementedException where I should have been using a NotSupportedException . At first I did not agree. There was a method on an interface which
Read More...
When developing my immutable collections library , I spent a lot of time on usability. After all, if a library is not useful then what’s the point? A big portion of usability is being able to work with existing frameworks and technologies. For .Net and
Read More...
I am a huge fan of read only/immutable collections and data. Hopefully the increased exposure through the blogosphere alerted users to the advantages of this type of programming for the appropriate scenarios. I wanted to discuss ReadOnlyCollection<T>
Read More...
Really this guideline is a bit longer but putting it all in a blog title seemed a bit too much. The full guideline should read: "If a generic class constructor arguments contain types of all generic parameters, provide a static method named
Read More...