Why we don't add try catch when using New operation

c#, exception

Solution

Is it guaranteed that the call will always be successful ?

No, this is not guaranteed.

That being said, in general, it's only a good idea to handle exceptions that you can actually do something about. By convention, it's a good idea to design your object construction in such a way to minimize exceptions. That being said, this is not always possible, and many cases, calling `new Foo()` can easily throw an exception you may want to catch.

For example, if you try to do this, you're guaranteed to raise an exception, as this is longer than the maximum number of items allowed in an array in a single dimension (even with `gcAllowVeryLargeObjects` set):

var willCauseException = new double[int.MaxValue];

Problem

,In C# and C++ , no one uses exception handling for `new` operator ,what's the reason ? Is it guaranteed that the call will always be successful ?

Original source