Can object constructor return a null?

前端 未结 5 1019
伪装坚强ぢ
伪装坚强ぢ 2020-12-30 19:32

We have taken over some .NET 1.1 Windows Service code that spawns threads to read messages off a queue (SeeBeyond eGate JMS queue, but that is not important) and in turn spa

5条回答
  •  Happy的楠姐
    2020-12-30 19:45

    You can make it appear like an object ctor returns null:

    http://seattlesoftware.wordpress.com/2008/03/05/returning-null-from-a-class-constructor/

    Search for "Another pattern which I haven’t seen used allows an invalid object to emulate a null reference" and read from there.

提交回复
热议问题