Assembla home | Assembla project page
 

Changeset 150

Show
Ignore:
Timestamp:
05/05/08 17:49:24 (2 months ago)
Author:
Vice
Message:

Fix Currency & Money comparison . Thanks Toyin.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/QLNet/QLNet/Currencies/Currency.cs

    r61 r150  
    8484 
    8585        /*! \relates Currency */ 
    86         public static bool operator ==(Currency c1, Currency c2) { return c1.name == c2.name; } 
     86        public static bool operator ==(Currency c1, Currency c2)  
     87        { 
     88           if (c1 == null && c2 == null) return true; 
     89           else if (c1 == null || c2 == null) return false; 
     90           else return c1.name == c2.name;  
     91        } 
    8792        public static bool operator !=(Currency c1, Currency c2) { return !(c1 == c2); } 
    8893        public static Money operator *(double value, Currency c) { return new Money(value, c); 
  • trunk/QLNet/QLNet/Money.cs

    r77 r150  
    189189      public static bool  operator ==(Money m1,Money m2)  
    190190      { 
    191          if (m1.currency == m2.currency)  
     191         if (m1 == null && m2 == null)  
     192            return true; 
     193         else if (m1 == null || m2 == null)  
     194            return false; 
     195         else if (m1.currency == m2.currency)  
    192196         { 
    193197            return m1.value == m2.value;