Class ReadOnlyPropertiesDictionary
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
infoSerializationInfoThe SerializationInfo that holds the serialized object data.
contextStreamingContextThe 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
propertiesDictionaryReadOnlyPropertiesDictionaryproperties 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
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
See IsReadOnly.
public bool IsReadOnly { get; }
Property Value
this[string]
Gets or sets the value of the property with the specified key.
public virtual object? this[string key] { get; set; }
Parameters
keystringThe 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
Values
See Values.
public ICollection<object?> Values { get; }
Property Value
Methods
Add(KeyValuePair<string, object?>)
See Add(T).
public void Add(KeyValuePair<string, object?> item)
Parameters
itemKeyValuePair<string, object>
Add(string, object?)
See Add(TKey, TValue).
public virtual void Add(string key, object? value)
Parameters
Clear()
Removes all properties from the properties collection
public virtual void Clear()
Contains(KeyValuePair<string, object?>)
See Contains(T).
public bool Contains(KeyValuePair<string, object?> item)
Parameters
itemKeyValuePair<string, object>
Returns
Contains(string)
Test if the dictionary contains a specified key
public bool Contains(string key)
Parameters
keystringthe 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)
See ContainsKey(TKey).
public bool ContainsKey(string key)
Parameters
keystring
Returns
CopyTo(KeyValuePair<string, object?>[], int)
See CopyTo(T[], int).
public void CopyTo(KeyValuePair<string, object?>[] array, int arrayIndex)
Parameters
arrayKeyValuePair<string, object>[]arrayIndexint
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
infoSerializationInfoThe SerializationInfo to populate with data.
contextStreamingContextThe 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
itemKeyValuePair<string, object>
Returns
Remove(string)
See Remove(TKey).
public virtual bool Remove(string key)
Parameters
keystring
Returns
TryGetValue(string, out object?)
public bool TryGetValue(string key, out object? value)