C# Developers' Journal (original) (raw)

11:59a

Constructor Failure Hey guys. I know I've seen this before, but I can't, for the life of me, remember how to do it or where I saw it . . .

I need to tell a constructor to fail. Basically, I'm wrapping some unmanaged calls to a system DLL. I need to tell the class constructor to gracefully catch the exception and return null if there was an error in the constructor. Anyone know / remember how to do this?

( Code SampleCollapse )

Thanks.

(2 Comments |Comment on this)