Chris,

  CS> In a nutshell, as a C++ developer, various people hammered
  CS> into my brain that throwing an exception in a constructor
  CS> (whether intentionally or by performing some action which
  CS> would cause an exception to be thrown) was extremely bad.
  CS> However, my research seems to indicate that .NET handles
  CS> constructors differently, allowing developers to perform
  CS> actions in a constructor that may result in exceptions being
  CS> thrown, or to <gasp> even throw an exception themselves.

Throwing exceptions from instance constructors poses no problem. However,
throwing them from *static* constructors is not a good idea, since, the
static constructors, as opposed to instance constructors, aren't called
explicitly, so there's no nice mechanism to handle them.

HTH,

Stefan

===================================
This list is hosted by DevelopMentorŪ  http://www.develop.com
Some .NET courses you may be interested in:

NEW! Guerrilla ASP.NET, 17 May 2004, in Los Angeles
http://www.develop.com/courses/gaspdotnetls

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to