Skip to main content
7 events
when toggle format what by license comment
Nov 8, 2011 at 20:46 comment added Aaronaught In this case, you could still write using (b as IDisposable) because you can put null in a using clause. Seems a bit anal-retentive, though; if you're so worried about the "base class problem", use an IoC container. No more worries.
Nov 7, 2011 at 19:10 comment added DeadMG @Loki: The base class problem is much more important as a problem. For example, the original IEnumerable didn't inherit from IDisposable, and there were a bunch of special iterators which could never be implemented as a result.
Nov 7, 2011 at 19:10 comment added DeadMG @Nemanja: Let's be fair, you can free() in the finally.
Nov 7, 2011 at 18:52 comment added Nemanja Trifunovic @KonradRudolph: It is worse than malloc and free. At least in C you don't have exceptions.
Nov 7, 2011 at 17:59 comment added Konrad Rudolph “When it comes to closing files in Java, it's malloc() and free() over there.” – Absolutely.
Nov 7, 2011 at 17:58 comment added Loki Astari I agree that RAII is the bees knees. But the using clause is a great step forward for C# over Java. It does allow deterministic destruction and thus correct resource management (its not quite as good as RAII as you need to remember to do it, but its definitely a good idea).
Nov 7, 2011 at 15:43 history answered DeadMG CC BY-SA 3.0