ArchivableDictionary

References

Represents a dictionary class that can be attached to objects and can be serialized (saved) at necessity.

See remarks for layout.

Remarks:

This is the layout of this object:

BEGINCHUNK (TCODE_ANONYMOUS_CHUNK)
|- version (int)
|- entry count (int)
   for entry count entries
   |- BEGINCHUNK (TCODE_ANONYMOUS_CHUNK)
   |- key (string)
   |- entry contents
   |- ENDCHUNK (TCODE_ANONYMOUS_CHUNK)
ENDCHUNK (TCODE_ANONYMOUS_CHUNK)

Constructors

ArchivableDictionary

#Since v5.0
Initializes an instance of a dictionary for writing to a 3dm archive.
public ArchivableDictionary()

ArchivableDictionary

#Since v5.0
Initializes an instance of a dictionary for writing to a 3dm archive.
public ArchivableDictionary(
version,
custom version used to help the plug-in developer determine which version of a dictionary is being written. One good way to write version information is to use a date style integer (YYYYMMDD)
name
Optional name to associate with this dictionary. NOTE: if this dictionary is set as a sub-dictionary, the name will be changed to the sub-dictionary key entry
)

ArchivableDictionary

#Since v5.0
Initializes an instance of a dictionary for writing to a 3dm archive.
public ArchivableDictionary(
version
Custom version used to help the plug-in developer determine which version of a dictionary is being written. One good way to write version information is to use a date style integer (YYYYMMDD)
)

ArchivableDictionary

#
Protected constructor for internal use.
protected ArchivableDictionary(
info,
Serialization data.
context
Serialization stream.
)

ArchivableDictionary

#Since v5.0
Initializes an instance of a dictionary for writing to a 3dm archive
public ArchivableDictionary(
parentUserData
parent user data if this dictionary is associated with user data
)

Properties

ChangeSerialNumber

#Since v7.8
Retrieve current change serial number. This is a number that gets increased each time a datum is set or changed.
[CLSCompliant(false)] public uint ChangeSerialNumber { get; }

Count

#Since v5.0
Gets the number of key/value pairs contained in the dictionary.
public int Count { get; }

Keys

#Since v5.0
Gets all entry names or keys.
public string[] Keys { get; }

Name

#Since v5.0
Gets or sets the name string of this ArchivableDictionary.
public string Name { get; set; }

ParentUserData

#Since v5.0
If this dictionary is part of user-data (or is a UserDictionary), then this is the parent user data. null if this dictionary is not part of user-data
public UserData ParentUserData { get; }
Explicit

IDictionary<string, object>.Values

#Since v5.0

Values

#Since v5.0
Gets all values in this dictionary.
public object[] Values { get; }

Version

#Since v5.0
Gets or sets the version of this ArchivableDictionary.
public int Version { get; set; }

Indexers

this[]

#
Gets the value associated with the specified key.
public object this[
key
The key of the value to get or set.
] { get; set; }
The value associated with the specified key. If the specified key is not found, a get operation throws a KeyNotFoundException.
ArgumentNullExceptionIf the key is null.
KeyNotFoundExceptionIf the key is not found.

Methods

AddContentsFrom

#Since v5.4
Add the contents from the source dictionary.
public bool AddContentsFrom()

Clear

#Since v5.0
Removes all keys and values from the dictionary.
public void Clear()

Clone

#Since v5.0
Constructs a deep copy of this object.
public ArchivableDictionary Clone()
The copy of this object.

ContainsKey

#Since v5.0
Determines whether the dictionary contains the specified key.
public bool ContainsKey(
key
The key to locate.
)
true if the dictionary contains an element with the specified key; otherwise, false.
ArgumentNullExceptionkey is null.

GetBool

#Since v5.0
Get value as Boolean, will return defaultValue unless value was created using Set(string key, Boolean value)
public bool GetBool(
key,
defaultValue
)

GetBool

#Since v5.0
Get value as Boolean, will only succeed if value was created using Set(string key, Boolean value)
public bool GetBool(
key
)

GetBytes

#Since v5.9
Get value as byte[], will return defaultValue unless value was created using Set(string key, byte[] value)
public byte[] GetBytes(
key,
byte[]
defaultValue
)

GetBytes

#Since v5.9
Get value as byte[], will only succeed if value was created using Set(string key, byte[] value)
public byte[] GetBytes(
key
)

GetDictionary

#Since v5.9
Get value as ArchivableDictionary, will return defaultValue unless value was created using Set(string key, ArchivableDictionary value)
public ArchivableDictionary GetDictionary(
key,
defaultValue
)

GetDictionary

#Since v5.9
Get value as ArchivableDictionary, will only succeed if value was created using Set(string key, ArchivableDictionary value)
public ArchivableDictionary GetDictionary(
key
)

GetDouble

#Since v5.10
Get value as double, will only succeed if value was created using Set(string key, double value)
public double GetDouble(
key,
defaultValue
)

GetDouble

#Since v5.0
Get value as double, will only succeed if value was created using Set(string key, double value)
public double GetDouble(
key
)

GetEnumerator

#Since v5.0
Gets the enumerator of this dictionary.
public IEnumerator<KeyValuePair<string, object>> GetEnumerator()
A IEnumerator<T>, where T is an instance of KeyValuePair<T0, T1>, with T0 set as string, and T1 as System.Object.

GetEnumValue<T>

#Since v5.4
Get an enum value
[CLSCompliant(false)] public T GetEnumValue<T>()
KeyNotFoundExceptionThrown when the key is not found in the dictionary.
FormatExceptionThrown when the string retrieved from the dictionary is not convertible to the enum type.

GetEnumValue<T>

#Since v5.4
Get an enum value from the dictionary using a custom key.
[CLSCompliant(false)] public T GetEnumValue<T>(
key
)
KeyNotFoundExceptionThrown when the key is not found in the dictionary.
FormatExceptionThrown when the string retrieved from the dictionary is not convertible to the enum type.

GetFloat

#Since v5.0
Get value as float, will return defaultValue unless value was created using Set(string key, float value)
public float GetFloat(
key,
defaultValue
)

GetFloat

#Since v5.0
Get value as float, will only succeed if value was created using Set(string key, float value)
public float GetFloat(
key
)

GetGuid

#Since v5.0
Get value as Guid, will return defaultValue unless value was created using Set(string key, Guid value)
public Guid GetGuid(
key,
defaultValue
)

GetGuid

#Since v5.0
Get value as Guid, will only succeed if value was created using Set(string key, Guid value)
public Guid GetGuid(
key
)

Getint

#Since v5.0
Get value as int, will return defaultValue unless value was created using Set(string key, int value)
public int Getint(
key,
defaultValue
)

GetInteger

#Since v5.0
Get value as int, will return defaultValue unless value was created using Set(string key, int value)
public int GetInteger(
key,
defaultValue
)

GetInteger

#Since v5.0
Get value as int, will only succeed if value was created using Set(string key, int value)
public int GetInteger(
key
)

GetObjectData

#Since v7.0
Populates a System.Runtime.Serialization.SerializationInfo with the data needed to serialize the target object.
[SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.SerializationFormatter)] public virtual void GetObjectData(
info,
The System.Runtime.Serialization.SerializationInfo to populate with data.
context
The destination (see System.Runtime.Serialization.StreamingContext) for this serialization.
)

GetPlane

#Since v6.11
Get value as Plane, will return defaultValue unless value was created using Set(string key, Plane value)
public Plane GetPlane(
key,
The key.
defaultValue
The default value.
)
The value as Plane.

GetPlane

#Since v6.11
Get value as Plane, will return defaultValue unless value was created using Set(string key, Plane value)
public Plane GetPlane(
key
The key.
)
The value as Plane.

GetPoint3d

#Since v5.0
Get value as Point3d, will return defaultValue unless value was created using Set(string key, Point3d value)
public Point3d GetPoint3d(
key,
defaultValue
)

GetPoint3d

#Since v5.0
Get value as Point3d, will only succeed if value was created using Set(string key, Point3d value)
public Point3d GetPoint3d(
key
)

GetPoint3f

#Since v5.0
Get value as Point3f, will return defaultValue unless value was created using Set(string key, Point3f value)
public Point3f GetPoint3f(
key,
defaultValue
)

GetPoint3f

#Since v5.0
Get value as Point3f, will only succeed if value was created using Set(string key, Point3f value)
public Point3f GetPoint3f(
key
)

GetString

#Since v5.0
Get value as string, will return defaultValue unless value was created using Set(string key, string value)
public string GetString(
key,
The key which points to the string
defaultValue
The string
)

GetString

#Since v5.0
Get value as string, will only succeed if value was created using Set(string key, string value)
public string GetString(
key
The key which points to the string
)
The string

GetVector3d

#Since v5.0
Get value as Vector3d, will return defaultValue unless value was created using Set(string key, Vector3d value)
public Vector3d GetVector3d(
key,
defaultValue
)

GetVector3d

#Since v5.0
Get value as Vector3d, will only succeed if value was created using Set(string key, Vector3d value)
public Vector3d GetVector3d(
key
)

Remove

#Since v5.0
Removes the value with the specified key from the dictionary.
public bool Remove(
key
The key of the element to remove.
)
true if the element is successfully found and removed; otherwise, false. This method returns false if key is not found.
ArgumentNullExceptionKey is null.

RemoveEnumValue<T>

#Since v5.4
Remove an enum value from the dictionary.
[CLSCompliant(false)] public bool RemoveEnumValue<T>()

ReplaceContentsWith

#Since v5.4
Replace the contents of the dictionary with that of the given source dictionary.
public bool ReplaceContentsWith()

Set

#Since v5.0
Sets another ArchivableDictionary as entry in this dictionary.
public bool Set(
key,
A text key.
val
An object for that key.

Because this class is a reference type and is mutable, changes to this object will propagate to the object inside the dictionary.

It is up to the user to clone this entry when appropriate.

)

Set

#Since v5.0
Sets a bool.
public bool Set(
key,
The text key.
val
A bool value.

Because bool has value semantics, changes to the assigning value will leave this entry unchanged.

)
true if set operation succeeded, otherwise false.

Set

#Since v5.0
Sets a BoundingBox.
public bool Set(
key,
A text key.
val
A value for that key.

Because BoundingBox has value semantics, changes to the assigning value will leave this entry unchanged.

)

Set

#Since v5.0
Sets a byte.
public bool Set(
key,
The text key.
val
A byte.

Because byte has value semantics, changes to the assigning value will leave this entry unchanged.

)
true if set operation succeeded, otherwise false.

Set

#Since v5.0
Sets a Color.
public bool Set(
key,
A text key.
val
A value for that key.

Because Color has value semantics, changes to the assigning value will leave this entry unchanged.

)
true if set operation succeeded, otherwise false.

Set

#Since v5.0
Sets a double.
public bool Set(
key,
The text key.
val
A double.

Because double has value semantics, changes to the assigning value will leave this entry unchanged.

)
true if set operation succeeded, otherwise false.

Set

#Since v5.0
Sets a float.
public bool Set(
key,
The text key.
val
A float.

Because float has value semantics, changes to the assigning value will leave this entry unchanged.

)
true if set operation succeeded, otherwise false.

Set

#Since v5.0
Sets a Font.
public bool Set(
key,
A text key.
val
A value for that key.

Because Font is immutable, it is not possible to modify the object while it is in this dictionary.

)

Set

#Since v5.0
Sets any class deriving from the GeometryBase base class.
public bool Set(
key,
A text key.
val
A geometry object for that key.

Because this class is a reference type and is mutable, changes to this object will propagate to the object inside the dictionary.

It is up to the user to clone this entry when appropriate. You can use GeometryBase.Duplicate() for this.

)

Set

#Since v5.0
Sets a Guid.
public bool Set(
key,
The text key.
val
A Guid.

Because Guid has value semantics, changes to the assigning value will leave this entry unchanged.

)
true if set operation succeeded, otherwise false.

Set

#Since v5.0
Sets a list, an array or any enumerable of bool.
public bool Set(
key,
A text key.
val
A value for that key.

Because this interface is a reference type, changes to the assigned object will modify this entry inside the dictionary.

It is up to the user to clone this entry when appropriate.

)
true if set operation succeeded, otherwise false.

Set

#Since v5.0
Sets a list, an array or any enumerable of byte.
public bool Set(
key,
A text key.
val
A value for that key

Because this interface is a reference type, changes to the assigned object will modify this entry inside the dictionary.

It is up to the user to clone this entry when appropriate.

)
true if set operation succeeded, otherwise false.

Set

#Since v5.0
Sets a list, an array or any enumerable of double.
public bool Set(
key,
A text key.
val
A value for that key.

Because this interface is a reference type, changes to the assigned object will modify this entry inside the dictionary.

It is up to the user to clone this entry when appropriate.

)
true if set operation succeeded, otherwise false.

Set

#Since v5.0
Sets a list, an array or any enumerable of float.
public bool Set(
key,
A text key.
val
A value for that key.

Because this interface is a reference type, changes to the assigned object will modify this entry inside the dictionary.

It is up to the user to clone this entry when appropriate.

)
true if set operation succeeded, otherwise false.

Set

#Since v7.0
Sets an array of GeometryBase
public bool Set(
key,
A text key
val
An object for that key

Because this class is a reference type and is mutable, changes to this object will propagate to the object inside the dictionary.

It is up to the user to clone this entry when appropriate.

)
true if successful, false otherwise.

Set

#Since v5.0
Sets a list, an array or any enumerable of Guid.
public bool Set(
key,
A text key.
val
A value for that key.

Because this interface is a reference type, changes to the assigned object will modify this entry inside the dictionary.

It is up to the user to clone this entry when appropriate.

)
true if set operation succeeded, otherwise false.

Set

#Since v5.0
Sets a list, an array or any enumerable of int.
public bool Set(
key,
A text key.
val
A value for that key.

Because this interface is a reference type, changes to the assigned object will modify this entry inside the dictionary.

It is up to the user to clone this entry when appropriate.

)
true if set operation succeeded, otherwise false.

Set

#Since v5.8
Sets an array of ObjRef
public bool Set(
key,
A text key
val
An object for that key

Because this class is a reference type and is mutable, changes to this object will propagate to the object inside the dictionary.

It is up to the user to clone this entry when appropriate.

)

Set

#Since v5.0
Sets a list, an array or any enumerable of sbyte.
[CLSCompliant(false)] public bool Set(
key,
A text key.
val
A value for that key.

Because this interface is a reference type, changes to the assigned object will modify this entry inside the dictionary.

It is up to the user to clone this entry when appropriate.

)
true if set operation succeeded, otherwise false.

Set

#Since v5.0
Sets a list, an array or any enumerable of short.
public bool Set(
key,
A text key.
val
A value for that key.

Because this interface is a reference type, changes to the assigned object will modify this entry inside the dictionary.

It is up to the user to clone this entry when appropriate.

)
true if set operation succeeded, otherwise false.

Set

#Since v5.0
Sets a list, an array or any enumerable of string.
public bool Set(
key,
A text key.
val
A value for that key.

Because this interface is a reference type, changes to the assigned object will modify this entry inside the dictionary.

It is up to the user to clone this entry when appropriate.

)
true if set operation succeeded, otherwise false.

Set

#Since v5.0
Sets a int.
public bool Set(
key,
The text key.
val
A int.

Because int has value semantics, changes to the assigning value will leave this entry unchanged.

)
true if set operation succeeded, otherwise false.

Set

#Since v5.0
Sets an Interval.
public bool Set(
key,
A text key.
val
A value for that key.

Because Interval has value semantics, changes to the assigning value will leave this entry unchanged.

)

Set

#Since v5.0
Sets a Line.
public bool Set(
key,
A text key.
val
A value for that key.

Because Line has value semantics, changes to the assigning value will leave this entry unchanged.

)

Set

#Since v5.0
Sets a long.
public bool Set(
key,
The text key.
val
A long.

Because long has value semantics, changes to the assigning value will leave this entry unchanged.

)
true if set operation succeeded, otherwise false.

Set

#Since v5.0
public bool Set(
key,
A text key.
val
An object for that key.

Because this class is a reference type and is mutable, changes to this object will propagate to the object inside the dictionary.

It is up to the user to clone this entry when appropriate.

)

Set

#Since v5.8
Sets a ObjRef
public bool Set(
key,
A text key
val
An object for that key

Because this class is a reference type and is mutable, changes to this object will propagate to the object inside the dictionary.

It is up to the user to clone this entry when appropriate.

)

Set

#Since v5.0
Sets a Plane.
public bool Set(
key,
A text key.
val
A plane for that key.

Because Plane has value semantics, changes to the assigning value will leave this entry unchanged.

)

Set

#Since v5.0
Sets a Point.
public bool Set(
key,
A text key.
val
A value for that key.

Because Point has value semantics, changes to the assigning value will leave this entry unchanged.

)

Set

#Since v5.0
Sets a Point2d.
public bool Set(
key,
A text key.
val
A point for that key.

Because Point2d has value semantics, changes to the assigning value will leave this entry unchanged.

)

Set

#Since v5.0
Sets a Point3d.
public bool Set(
key,
A text key.
val
A point for that key.

Because Point3d has value semantics, changes to the assigning value will leave this entry unchanged.

)

Set

#Since v5.0
Sets a Point3f.
public bool Set(
key,
A text key.
val
A value for that key.

Because Point3f has value semantics, changes to the assigning value will leave this entry unchanged.

)

Set

#Since v5.0
Sets a Point4d.
public bool Set(
key,
A text key.
val
A value for that key.

Because Point4d has value semantics, changes to the assigning value will leave this entry unchanged.

)

Set

#Since v5.0
Sets a PointF.
public bool Set(
key,
A text key.
val
A value for that key.

Because PointF has value semantics, changes to the assigning value will leave this entry unchanged.

)

Set

#Since v5.0
Sets a Ray3d.
public bool Set(
key,
A text key.
val
A value for that key.

Because Ray3d has value semantics and is immutable, no changes to this object are possible.

)

Set

#Since v5.0
Sets a Rectangle.
public bool Set(
key,
A text key.
val
A value for that key.

Because Rectangle has value semantics, changes to the assigning value will leave this entry unchanged.

)

Set

#Since v5.0
Sets a RectangleF.
public bool Set(
key,
A text key.
val
A value for that key.

Because RectangleF has value semantics, changes to the assigning value will leave this entry unchanged.

)

Set

#Since v5.0
Sets a sbyte.
[CLSCompliant(false)] public bool Set(
key,
The text key.
val
A sbyte.

Because sbyte has value semantics, changes to the assigning value will leave this entry unchanged.

)
true if set operation succeeded, otherwise false.

Set

#Since v5.0
Sets a short.
public bool Set(
key,
The text key.
val
A short.

Because short has value semantics, changes to the assigning value will leave this entry unchanged.

)
true if set operation succeeded, otherwise false.

Set

#Since v5.0
Sets a Size.
public bool Set(
key,
A text key.
val
A value for that key.

Because Size has value semantics, changes to the assigning value will leave this entry unchanged.

)

Set

#Since v5.0
Sets a SizeF.
public bool Set(
key,
A text key.
val
A value for that key.

Because SizeF has value semantics, changes to the assigning value will leave this entry unchanged.

)

Set

#Since v5.0
Sets a string.
public bool Set(
key,
The text key.
val
A string.

Because string is immutable, it is not possible to modify the object while it is in this dictionary.

)
true if set operation succeeded, otherwise false.

Set

#Since v5.0
Sets a Transform.
public bool Set(
key,
A text key.
val
A transform for that key.

Because Transform has value semantics, changes to the assigning value will leave this entry unchanged.

)

Set

#Since v5.0
Sets a uint.
[CLSCompliant(false)] public bool Set(
key,
The text key.
val
A uint.

Because uint has value semantics, changes to the assigning value will leave this entry unchanged.

)
true if set operation succeeded, otherwise false.

Set

#Since v5.0
Sets a ushort.
[CLSCompliant(false)] public bool Set(
key,
The text key.
val
A ushort.

Because ushort has value semantics, changes to the assigning value will leave this entry unchanged.

)
true if set operation succeeded, otherwise false.

Set

#Since v5.0
Sets a Vector2d.
public bool Set(
key,
A text key.
val
A value for that key.

Because Vector2d has value semantics, changes to the assigning value will leave this entry unchanged.

)

Set

#Since v5.0
Sets a Vector3d.
public bool Set(
key,
A text key.
val
A value for that key.

Because Vector3d has value semantics, changes to the assigning value will leave this entry unchanged.

)

Set

#Since v5.0
Sets a Vector3f.
public bool Set(
key,
A text key.
val
A value for that key.

Because Vector3f has value semantics, changes to the assigning value will leave this entry unchanged.

)

SetEnumValue<T>

#Since v5.4
Set an enum value in the dictionary with a custom key.
[CLSCompliant(false)] public bool SetEnumValue<T>(
key,
T
enumValue
)

SetEnumValue<T>

#Since v5.4
Set an enum value
[CLSCompliant(false)] public bool SetEnumValue<T>(
T
enumValue
)
Explicit

IDictionary<string, object>.Add

#
This is not supported and always throws NotSupportedException.
void IDictionary<string, object>.Add(
key,
Unused.
value
Unused.
)
Explicit

IEnumerable.GetEnumerator

#Since v5.0
Gets the enumerator of this dictionary.
IEnumerator IEnumerable.GetEnumerator()
A IEnumerator<T>, where T is an instance of KeyValuePair<T0, T1>, with T0 set as string, and T1 as System.Object.
Explicit

ICloneable.Clone

#Since v5.0

TryGetBool

#Since v5.0
Get value as Boolean, will only succeed if value was created using Set(string key, Boolean value)
public bool TryGetBool(
key,
out bool
value
)

TryGetBytes

#Since v5.9
Get value as byte[], will only succeed if value was created using Set(string key, byte[] value)
public bool TryGetBytes(
key,
out byte[]
value
)

TryGetDictionary

#Since v5.9
Get value as ArchivableDictionary, will only succeed if value was created using Set(string key, ArchivableDictionary value)
public bool TryGetDictionary()

TryGetDouble

#Since v5.0
Get value as double, will only succeed if value was created using Set(string key, double value)
public bool TryGetDouble(
key,
out double
value
)

TryGetEnumValue<T>

#Since v5.4
Attempt to get an enum value from the dictionary using a custom key.
[CLSCompliant(false)] public bool TryGetEnumValue<T>(
key,
out T
enumValue
)

TryGetFloat

#Since v5.0
Get value as float, will only succeed if value was created using Set(string key, float value)
public bool TryGetFloat(
key,
out float
value
)

TryGetGuid

#Since v5.0
Get value as Guid, will only succeed if value was created using Set(string key, Guid value)
public bool TryGetGuid(
key,
out Guid
value
)

TryGetInteger

#Since v5.0
Get value as int, will only succeed if value was created using Set(string key, int value)
public bool TryGetInteger(
key,
out int
value
)

TryGetPlane

#Since v6.11
Get value as Plane, will only succeed if value was created using Set(string key, Plane value)
public bool TryGetPlane(
key,
The key.
out Plane
value
The value.
)
The value as Plane.

TryGetPoint3d

#Since v5.0
Get value as Point3d, will only succeed if value was created using Set(string key, Point3d value)
public bool TryGetPoint3d(
key,
out Point3d
value
)

TryGetPoint3f

#Since v5.0
Get value as Point3f, will only succeed if value was created using Set(string key, Point3f value)
public bool TryGetPoint3f(
key,
out Point3f
value
)

TryGetString

#Since v5.0
Get value as string, will only succeed if value was created using Set(string key, string value)
public bool TryGetString(
key,
out string
value
)

TryGetValue

#Since v5.0
Gets the value associated with the specified key.
public bool TryGetValue(
key,
The key of the value to get.
out object
value
When this method returns and if the key is found, contains the value associated with the specified key; otherwise, null. This parameter is passed uninitialized.
)
true if the dictionary contains an element with the specified key; otherwise, false.
ArgumentNullExceptionKey is null.

TryGetVector3d

#Since v5.0
Get value as Vector3d, will only succeed if value was created using Set(string key, Vector3d value)
public bool TryGetVector3d(
key,
value
)