[Mono-list] new operator in C#
Kala B
Kala B <kalabalun@gmail.com>
Wed, 6 Apr 2005 14:23:49 +0530
Hi,
If the C# new operator fails to allocate memory, does it return null?
( and throw the OutOfMemoryException). What is the expected/defined
behaviour ?
Is a null check enough ?
In C++, the new operator just throws the bad_alloc exception, on
failure. (Standard C++ states that operator new should throw an
exception of type std::bad_alloc when it fails.) It doesnot state that
it would return null.
It would be helpful to know the same for C#.
Thanks & Regards
Kala B.