Exception Safety and IDisposable Factories

C# is mostly relieved from the stress of exception safety, thanks to garbage collections. But in some cases it must be handled. A common case is factories creating more than one IDisposable object. Coming from a C++ background, the notion of exception safety is natural to me. For a C++ developer exception safety is as… Continue reading Exception Safety and IDisposable Factories

Using and Disposing of WCF Clients

Designing an interface always requires careful considerations of how it will be used. Scott Meyers elegantly catches the entire problem in one sentence in his book Effective C++: Make interfaces easy to use correctly and hard to use incorrectly. The people at Microsoft who were in charge for the WCF client code generation either hadn’t read… Continue reading Using and Disposing of WCF Clients

Disposable Base Class

I have covered the IDisposable interface in my previous posts IDisposable and using in C# and Implementing IDisposable. To make the implementation of IDisposable easier, I have written an abstract base class that handles the details of the IDisposable pattern. The objectives of the class is to: Provide a simple, reusable implementation of the disposable pattern. Pass all… Continue reading Disposable Base Class

Implementing IDisposable

In the IDisposable and using in C# post I showed how to handle an object that implements IDisposable. That’s the most common scenario, where a simple using will ensure that resources are properly and early released, but that only handles the case when the resource is created and disposed of in the same function. What… Continue reading Implementing IDisposable

IDisposable and using in C#

C# and the .NET environment have automatic memory management through garbage collection. Coming from C++ I think it’s great to not having to worry about memory deallocation. Unfortunately memory from the managed heap (which is where C# objects are placed)  is just one kind of resource in a system. There are several other types of… Continue reading IDisposable and using in C#