title: Exception handling in .NET vs Java
body: <p>I'm porting a library I wrote for Java to .NET C# and I'm dealing with differences in exception handling between the two worlds.</p>
  
  <p>In particular I have an <code>abstract</code> class that I use as base class to implement several services. In this class I have these methods:</p>
  
  <pre><code>public void MyConcreteMethod(){
  
      //...
      try {
          initialize();
      } catch(InitializationException ex){
          // ...
      }
  
      // ...
  
  }
  
  public abstract void initialize() throws InitializationException;
  </code></pre>
  
  <p>Every extending class must implement his way to <code>initialize</code> and I clearly know that I need to handle some possible <code>InitializationException</code>.</p>
  
  <p>In C# I converted my code like this:</p>
  
  <pre><code>public void MyConcreteMethod(){
  
      //...
  
      Initialize();
  
      // ...
  
  }
  
  public abstract void Initialize();
  </code></pre>
  
  <p>but this way I haven't a clear information about possible initialization problems: in some classes I could throw exception, and in others I could not.</p>
  
  <p>So should I hanlde them in <code>MyConcreteMethod</code>? Which exception shold I catch? A generic <code>Exception</code>?</p>