Blog Stats
  • Posts - 157
  • Articles - 0
  • Comments - 90
  • Trackbacks - 19

 

.NET

Spot the issue

While continuing my review adventures I encountered the following lines of code (I replaced the names of the objects): Hashtable myHash = new Hashtable(); myHash = Foo.GetHash(); Can you spot the issue? One hint: GC. Cross-posted from The .NET Aficionado...
  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

Spot the bug

Today I was reviewing some code. Now who can spot the exception that can be thrown in the finally block? I will give you a couple of hints: To prevent exceptions from being thrown the Open-Closed principle needs to be violated The second hint is directly related to the solution: RTTI using(IDbTransaction transaction = connection.BeginTransaction... { IDbDataAdapter dataAdapter = null; try { dataAdapter = CreateDataAdapter(); dataAdapter.UpdateCommand = updateCommand; dataAdapter.UpdateCommand.C...
  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

Which of the 3 timer types in the BCL do you need?

In case that you need a timer you can choose between 3 types in the Base Class Library:System.Timers.Timer... timer you should use to solve your problem depends on the problem you are trying to solve. I have found an article on the MSDN Magazine of February 2004 written by Alex Calvo which compares the 3 timers and outlines when to use which timer:http://msdn.microsoft... Cross-posted from The .NET Aficionado...
  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

 

 

Copyright © Gabriel Lozano-Morán