You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4net-dev@logging.apache.org by ni...@apache.org on 2004/12/19 20:22:47 UTC
cvs commit: logging-log4net/src/Core Level.cs
nicko 2004/12/19 11:22:47
Modified: src/Core Level.cs
Log:
Updates suggested by FxCop.
Minor naming changes to internal types.
Perf improvements to type check + type cast code.
Revision Changes Path
1.7 +9 -2 logging-log4net/src/Core/Level.cs
Index: Level.cs
===================================================================
RCS file: /home/cvs/logging-log4net/src/Core/Level.cs,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- Level.cs 6 Dec 2004 02:20:06 -0000 1.6
+++ Level.cs 19 Dec 2004 19:22:47 -0000 1.7
@@ -289,9 +289,10 @@
/// <exception cref="ArgumentException"><paramref name="r" /> is not a <see cref="Level" />.</exception>
public int CompareTo(object r)
{
- if (r is Level)
+ Level target = r as Level;
+ if (target != null)
{
- return Compare(this, (Level) r);
+ return Compare(this, target);
}
throw new ArgumentException("Parameter: r, Value: [" + r + "] is not an instance of Level");
}
@@ -465,6 +466,12 @@
/// </remarks>
public static int Compare(Level l, Level r)
{
+ // Reference equals
+ if ((object)l == (object)r)
+ {
+ return 0;
+ }
+
if (l == null && r == null)
{
return 0;