Table of Contents

Class ReadOnlyPropertiesDictionary

Namespace
log4net.Util
Assembly
log4net.dll

String keyed object map that is read only.

[Serializable]
public class ReadOnlyPropertiesDictionary : ISerializable, IDictionary, ICollection, IDictionary<string, object?>, ICollection<KeyValuePair<string, object?>>, IEnumerable<KeyValuePair<string, object?>>, IEnumerable
Inheritance
ReadOnlyPropertiesDictionary
Implements
Derived
Inherited Members

Remarks

This collection is readonly and cannot be modified. It is not thread-safe.

While this collection is serializable, only member objects that are serializable will be serialized along with this collection.

Constructors

ReadOnlyPropertiesDictionary()

Constructor

public ReadOnlyPropertiesDictionary()

Remarks

Initializes a new instance of the ReadOnlyPropertiesDictionary class.

ReadOnlyPropertiesDictionary(SerializationInfo, StreamingContext)

Deserialization constructor

[SuppressMessage("Style", "IDE0060:Remove unused parameter")]
protected ReadOnlyPropertiesDictionary(SerializationInfo info, StreamingContext context)

Parameters

info SerializationInfo

The SerializationInfo that holds the serialized object data.

context StreamingContext

The StreamingContext that contains contextual information about the source or destination.

Remarks

Initializes a new instance of the ReadOnlyPropertiesDictionary class with serialized data.

ReadOnlyPropertiesDictionary(ReadOnlyPropertiesDictionary)

Copy Constructor

public ReadOnlyPropertiesDictionary(ReadOnlyPropertiesDictionary propertiesDictionary)

Parameters

propertiesDictionary ReadOnlyPropertiesDictionary

properties to copy

Remarks

Initializes a new instance of the ReadOnlyPropertiesDictionary class.

Properties

Count

The number of properties in this collection

public int Count { get; }

Property Value

int

InnerHashtable

The hashtable used to store the properties

protected Dictionary<string, object?> InnerHashtable { get; }

Property Value

Dictionary<string, object>

The internal collection used to store the properties

Remarks

The hashtable used to store the properties

IsReadOnly

public bool IsReadOnly { get; }

Property Value

bool

this[string]

Gets or sets the value of the property with the specified key.

public virtual object? this[string key] { get; set; }

Parameters

key string

The key of the property to get or set.

Property Value

object

The value of the property with the specified key, or null if a property is not present in the dictionary. Note this is the IDictionary semantic, not that of IDictionary<TKey, TValue>.

Remarks

The property value will only be serialized if it is serializable. If it cannot be serialized it will be silently ignored if a serialization operation is performed.

Keys

See Keys.

[SuppressMessage("Naming", "CA1721:Property names should not match get methods")]
public ICollection<string> Keys { get; }

Property Value

ICollection<string>

Values

See Values.

public ICollection<object?> Values { get; }

Property Value

ICollection<object>

Methods

Add(KeyValuePair<string, object?>)

See Add(T).

public void Add(KeyValuePair<string, object?> item)

Parameters

item KeyValuePair<string, object>

Add(string, object?)

public virtual void Add(string key, object? value)

Parameters

key string
value object

Clear()

Removes all properties from the properties collection

public virtual void Clear()

Contains(KeyValuePair<string, object?>)

public bool Contains(KeyValuePair<string, object?> item)

Parameters

item KeyValuePair<string, object>

Returns

bool

Contains(string)

Test if the dictionary contains a specified key

public bool Contains(string key)

Parameters

key string

the key to look for

Returns

bool

true if the dictionary contains the specified key

Remarks

Test if the dictionary contains a specified key

ContainsKey(string)

public bool ContainsKey(string key)

Parameters

key string

Returns

bool

CopyTo(KeyValuePair<string, object?>[], int)

public void CopyTo(KeyValuePair<string, object?>[] array, int arrayIndex)

Parameters

array KeyValuePair<string, object>[]
arrayIndex int

GetKeys()

Gets the key names.

public string[] GetKeys()

Returns

string[]

An array of all the keys.

Remarks

Gets the key names.

GetObjectData(SerializationInfo, StreamingContext)

Serializes this object into the SerializationInfo provided.

[SecurityCritical]
[SecurityPermission(SecurityAction.Demand, SerializationFormatter = true)]
public virtual void GetObjectData(SerializationInfo info, StreamingContext context)

Parameters

info SerializationInfo

The SerializationInfo to populate with data.

context StreamingContext

The destination for this serialization.

Remarks

Serializes this object into the SerializationInfo provided.

Remove(KeyValuePair<string, object?>)

See Remove(T).

public bool Remove(KeyValuePair<string, object?> item)

Parameters

item KeyValuePair<string, object>

Returns

bool

Remove(string)

public virtual bool Remove(string key)

Parameters

key string

Returns

bool

TryGetValue(string, out object?)

public bool TryGetValue(string key, out object? value)

Parameters

key string
value object

Returns

bool