[Mono-osx] Why a Null Value

Eric Hosick erichosick at gmail.com
Sat Aug 27 13:02:52 EDT 2011


Doh. Sent before I was finished...

On Sun, Aug 28, 2011 at 12:00 AM, Eric Hosick <erichosick at gmail.com> wrote:

> Hi All,
>
> I have the following code:
>
> class AggregateHashtable {
>   private Hashtable p_wrappedInstance = new Hashtable();
>
>   public AggregateHashtable() {
>     if ( null == p_wrappedInstance ) {
>       throw new Exception ("How did this get to be null?"); // Just to
> check if this is ever happening.
>     }
>   }
>    [XmlIgnore] public Hashtable wrappedInstance {
>     get { return p_wrappedInstance; }
>   }
>
>   // other code but never accesses p_wrappedInstance
> }
>
> During runtime somewhere in the code:
>
>   get {
>   AggregateHashtable iHashTable = ccmRoot.root as AggregateHashtable;
>   if ( null == iHashTable.wrappedInstance ) {
>   throw new Exception ("There is no way this can be null!");
>   }
>
> Ya. I see that exception "There is no way this can be null!". How does
> wrappedInstance become null? It is private in the AggregateHashtable class.
>
> Any ideas?
>
> Thanks,
>
> Eric
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-osx/attachments/20110828/25961cb2/attachment.html 


More information about the Mono-osx mailing list