Mercurial > repos > IBBoard
comparison EqualityChecker.cs @ 87:90b9a3fe3c18
* Correct licensing comments at top of files
* Add an EqualityChecker class to handle null-safe equality checks
no-open-ticket
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Sat, 21 Aug 2010 10:04:52 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
86:0744a1cc03cc | 87:90b9a3fe3c18 |
---|---|
1 // This file (EqualityChecker.cs) is a part of the IBBoard project and is copyright 2010 IBBoard | |
2 // | |
3 // The file and the library/program it is in are licensed and distributed, without warranty, under the GNU LGPL, either version 3 of the License or (at your option) any later version. Please see COPYING for more information and the full license. | |
4 using System; | |
5 namespace IBBoard | |
6 { | |
7 /// <summary> | |
8 /// Null-safe equality checker | |
9 /// </summary> | |
10 public class EqualityChecker | |
11 { | |
12 public static bool AreEqual(object obj1, object obj2) | |
13 { | |
14 bool areEqual = false; | |
15 | |
16 if ((obj1 == null && obj2 == null) || (obj1 != null && obj1.Equals(obj2))) | |
17 { | |
18 areEqual = true; | |
19 } | |
20 | |
21 return areEqual; | |
22 } | |
23 } | |
24 } | |
25 |