nicko 2004/12/19 11:22:35
Modified: src/Config ConfiguratorAttribute.cs
Log:
Updates suggested by FxCop.
Minor naming changes to internal types.
Perf improvements to type check + type cast code.
Revision Changes Path
1.8 +13 -13 logging-log4net/src/Config/ConfiguratorAttribute.cs
Index: ConfiguratorAttribute.cs
===================================================================
RCS file: /home/cvs/logging-log4net/src/Config/ConfiguratorAttribute.cs,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- ConfiguratorAttribute.cs 23 Nov 2004 01:37:29 -0000 1.7
+++ ConfiguratorAttribute.cs 19 Dec 2004 19:22:35 -0000 1.8
@@ -85,23 +85,23 @@
/// </remarks>
public int CompareTo(object obj)
{
+ // Reference equals
+ if ((object)this == obj)
+ {
+ return 0;
+ }
+
int result = -1;
- if (obj != null && obj is ConfiguratorAttribute)
+ ConfiguratorAttribute target = obj as
ConfiguratorAttribute;
+ if (target != null)
{
- if (obj == (object)this)
- {
- result = 0;
- }
- else
+ // Compare the priorities
+ result =
target.m_priority.CompareTo(m_priority);
+ if (result == 0)
{
- // Compare the priorities
- result =
((ConfiguratorAttribute)obj).m_priority.CompareTo(m_priority);
- if (result == 0)
- {
- // Same priority, so have to
provider some ordering
- result = -1;
- }
+ // Same priority, so have to provide
some ordering
+ result = -1;
}
}
return result;