Have you ever seen at runtime that an object (C #) returns null after it is created?

I know the strange question is: did someone have a case where a C # object returns null after creating it?

+4
source share
3 answers

Impossible in design, you will always get an OutOfMemory exception if a new object cannot be created. A damaged heap of garbage is technically possible, invariably caused by improper management of unmanaged code, but I have never heard of any cases where this did not raise an ExcecutionEngineException.

+5
source

Is this a trick?

int? i = new int?(); if (i == null) Console.WriteLine("It null!"); 
+6
source

I think he got bad logic in the constructor of his object. This is not the case with an object native to the asp.net infrastructure.

0
source

Source: https://habr.com/ru/post/1304154/


All Articles