nicko 2004/08/02 02:42:27
Modified: src/Util PropertiesDictionary.cs
ReadOnlyPropertiesDictionary.cs
Log:
Made the inner hashtable m_ht private
Revision Changes Path
1.7 +16 -16 logging-log4net/src/Util/PropertiesDictionary.cs
Index: PropertiesDictionary.cs
===================================================================
RCS file: /home/cvs/logging-log4net/src/Util/PropertiesDictionary.cs,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- PropertiesDictionary.cs 30 Jul 2004 17:32:55 -0000 1.6
+++ PropertiesDictionary.cs 2 Aug 2004 09:42:27 -0000 1.7
@@ -94,8 +94,8 @@
/// </remarks>
override public object this[string key]
{
- get { return m_ht[key]; }
- set { m_ht[key] = value; }
+ get { return InnerHashtable[key]; }
+ set { InnerHashtable[key] = value; }
}
#endregion Public Instance Properties
@@ -108,7 +108,7 @@
/// <param name="key">the key for the entry to remove</param>
public void Remove(string key)
{
- m_ht.Remove(key);
+ InnerHashtable.Remove(key);
}
#endregion Public Instance Methods
@@ -120,7 +120,7 @@
/// </summary>
IDictionaryEnumerator IDictionary.GetEnumerator()
{
- return m_ht.GetEnumerator();
+ return InnerHashtable.GetEnumerator();
}
/// <summary>
@@ -129,7 +129,7 @@
/// <param name="key"></param>
void IDictionary.Remove(object key)
{
- m_ht.Remove(key);
+ InnerHashtable.Remove(key);
}
/// <summary>
@@ -139,7 +139,7 @@
/// <returns></returns>
bool IDictionary.Contains(object key)
{
- return m_ht.Contains(key);
+ return InnerHashtable.Contains(key);
}
/// <summary>
@@ -147,7 +147,7 @@
/// </summary>
public override void Clear()
{
- m_ht.Clear();
+ InnerHashtable.Clear();
}
/// <summary>
@@ -161,7 +161,7 @@
{
throw new ArgumentException("key must be a
string", "key");
}
- m_ht.Add(key, value);
+ InnerHashtable.Add(key, value);
}
/// <summary>
@@ -183,7 +183,7 @@
{
throw new ArgumentException("key must
be a string", "key");
}
- return m_ht[key];
+ return InnerHashtable[key];
}
set
{
@@ -191,7 +191,7 @@
{
throw new ArgumentException("key must
be a string", "key");
}
- m_ht[key] = value;
+ InnerHashtable[key] = value;
}
}
@@ -200,7 +200,7 @@
/// </summary>
ICollection IDictionary.Values
{
- get { return m_ht.Values; }
+ get { return InnerHashtable.Values; }
}
/// <summary>
@@ -208,7 +208,7 @@
/// </summary>
ICollection IDictionary.Keys
{
- get { return m_ht.Keys; }
+ get { return InnerHashtable.Keys; }
}
/// <summary>
@@ -230,7 +230,7 @@
/// <param name="index"></param>
void ICollection.CopyTo(Array array, int index)
{
- m_ht.CopyTo(array, index);
+ InnerHashtable.CopyTo(array, index);
}
/// <summary>
@@ -238,7 +238,7 @@
/// </summary>
bool ICollection.IsSynchronized
{
- get { return m_ht.IsSynchronized; }
+ get { return InnerHashtable.IsSynchronized; }
}
/// <summary>
@@ -246,7 +246,7 @@
/// </summary>
object ICollection.SyncRoot
{
- get { return m_ht.SyncRoot; }
+ get { return InnerHashtable.SyncRoot; }
}
#endregion
@@ -258,7 +258,7 @@
/// </summary>
IEnumerator IEnumerable.GetEnumerator()
{
- return ((IEnumerable)m_ht).GetEnumerator();
+ return ((IEnumerable)InnerHashtable).GetEnumerator();
}
#endregion
1.2 +27 -19 logging-log4net/src/Util/ReadOnlyPropertiesDictionary.cs
Index: ReadOnlyPropertiesDictionary.cs
===================================================================
RCS file: /home/cvs/logging-log4net/src/Util/ReadOnlyPropertiesDictionary.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ReadOnlyPropertiesDictionary.cs 30 Jul 2004 17:32:55 -0000 1.1
+++ ReadOnlyPropertiesDictionary.cs 2 Aug 2004 09:42:27 -0000 1.2
@@ -45,7 +45,7 @@
/// <summary>
/// The Hashtable used to store the properties data
/// </summary>
- protected Hashtable m_ht = new Hashtable();
+ private Hashtable m_hashtable = new Hashtable();
#endregion Private Instance Fields
@@ -66,7 +66,7 @@
{
foreach(DictionaryEntry entry in propertiesDictionary)
{
- m_ht.Add(entry.Key, entry.Value);
+ InnerHashtable.Add(entry.Key, entry.Value);
}
}
@@ -86,7 +86,7 @@
foreach(SerializationEntry entry in info)
{
// The keys are stored as Xml encoded names
- m_ht[XmlConvert.DecodeName(entry.Name)] =
entry.Value;
+
InnerHashtable[XmlConvert.DecodeName(entry.Name)] = entry.Value;
}
}
#endif
@@ -102,8 +102,8 @@
/// <returns>An array of all the keys.</returns>
public string[] GetKeys()
{
- string[] keys = new String[m_ht.Count];
- m_ht.Keys.CopyTo(keys, 0);
+ string[] keys = new String[InnerHashtable.Count];
+ InnerHashtable.Keys.CopyTo(keys, 0);
return keys;
}
@@ -121,7 +121,7 @@
/// </remarks>
public virtual object this[string key]
{
- get { return m_ht[key]; }
+ get { return InnerHashtable[key]; }
set { throw new NotSupportedException("This is a Read
Only Dictionary and can not be modified"); }
}
@@ -136,11 +136,19 @@
/// <returns>true if the dictionary contains the specified
key</returns>
public bool Contains(string key)
{
- return m_ht.Contains(key);
+ return InnerHashtable.Contains(key);
}
#endregion
+ /// <summary>
+ /// The hashtable used to store the properties
+ /// </summary>
+ protected Hashtable InnerHashtable
+ {
+ get { return m_hashtable; }
+ }
+
#region Implementation of ISerializable
#if !NETCF
@@ -152,7 +160,7 @@
[System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.Demand,
SerializationFormatter=true)]
public void GetObjectData(SerializationInfo info,
StreamingContext context)
{
- foreach(DictionaryEntry entry in m_ht)
+ foreach(DictionaryEntry entry in InnerHashtable)
{
// If value is serializable then we add it to
the list
if (entry.Value.GetType().IsSerializable)
@@ -174,7 +182,7 @@
/// </summary>
IDictionaryEnumerator IDictionary.GetEnumerator()
{
- return m_ht.GetEnumerator();
+ return InnerHashtable.GetEnumerator();
}
/// <summary>
@@ -193,7 +201,7 @@
/// <returns></returns>
bool IDictionary.Contains(object key)
{
- return m_ht.Contains(key);
+ return InnerHashtable.Contains(key);
}
/// <summary>
@@ -230,7 +238,7 @@
get
{
if (!(key is string)) throw new
ArgumentException("key must be a string");
- return m_ht[key];
+ return InnerHashtable[key];
}
set
{
@@ -243,7 +251,7 @@
/// </summary>
ICollection IDictionary.Values
{
- get { return m_ht.Values; }
+ get { return InnerHashtable.Values; }
}
/// <summary>
@@ -251,7 +259,7 @@
/// </summary>
ICollection IDictionary.Keys
{
- get { return m_ht.Keys; }
+ get { return InnerHashtable.Keys; }
}
/// <summary>
@@ -259,7 +267,7 @@
/// </summary>
bool IDictionary.IsFixedSize
{
- get { return m_ht.IsFixedSize; }
+ get { return InnerHashtable.IsFixedSize; }
}
#endregion
@@ -273,7 +281,7 @@
/// <param name="index"></param>
void ICollection.CopyTo(Array array, int index)
{
- m_ht.CopyTo(array, index);
+ InnerHashtable.CopyTo(array, index);
}
/// <summary>
@@ -281,7 +289,7 @@
/// </summary>
bool ICollection.IsSynchronized
{
- get { return m_ht.IsSynchronized; }
+ get { return InnerHashtable.IsSynchronized; }
}
/// <summary>
@@ -289,7 +297,7 @@
/// </summary>
public int Count
{
- get { return m_ht.Count; }
+ get { return InnerHashtable.Count; }
}
/// <summary>
@@ -297,7 +305,7 @@
/// </summary>
object ICollection.SyncRoot
{
- get { return m_ht.SyncRoot; }
+ get { return InnerHashtable.SyncRoot; }
}
#endregion
@@ -309,7 +317,7 @@
/// </summary>
IEnumerator IEnumerable.GetEnumerator()
{
- return ((IEnumerable)m_ht).GetEnumerator();
+ return ((IEnumerable)InnerHashtable).GetEnumerator();
}
#endregion