• DuetAPI
  • DuetAPIClient
  • DuetControlServer
  • DuetWebServer
Show / Hide Table of Contents
  • DuetAPI
    • CodeChannel
    • CodeParserException
    • IncompatibleVersionException
    • InternalServerException
    • InvalidParameterTypeException
    • MissingParameterException
  • DuetAPI.Commands
    • Acknowledge
    • AddHttpEndpoint
    • AddUserSession
    • BaseCommand
    • BaseResponse
    • Cancel
    • CheckPassword
    • Code
    • CodeFlags
    • CodeParameter
    • CodeParameterConverter
    • CodeParserBuffer
    • CodeType
    • Command
    • Command<T>
    • ErrorResponse
    • EvaluateExpression
    • Flush
    • GetFileInfo
    • GetObjectModel
    • HttpResponseType
    • Ignore
    • InstallPlugin
    • InstallSystemPackage
    • InvalidateChannel
    • KeywordType
    • LockObjectModel
    • PatchObjectModel
    • ReceivedHttpRequest
    • ReloadPlugin
    • RemoveHttpEndpoint
    • RemoveUserSession
    • Resolve
    • ResolvePath
    • Response<T>
    • SendHttpResponse
    • SetNetworkProtocol
    • SetObjectModel
    • SetPluginData
    • SetPluginProcess
    • SetUpdateStatus
    • SimpleCode
    • StartPlugin
    • StartPlugins
    • StopPlugin
    • StopPlugins
    • SyncObjectModel
    • UninstallPlugin
    • UninstallSystemPackage
    • UnlockObjectModel
    • WriteMessage
  • DuetAPI.Connection
    • ConnectionMode
    • Defaults
    • InterceptionMode
    • SubscriptionMode
  • DuetAPI.Connection.InitMessages
    • ClientInitMessage
    • CodeStreamInitMessage
    • CommandInitMessage
    • InterceptInitMessage
    • PluginServiceInitMessage
    • ServerInitMessage
    • SubscribeInitMessage
  • DuetAPI.ObjectModel
    • Accelerometer
    • AccessLevel
    • AnalogSensor
    • AnalogSensorType
    • AnalogSensorTypeConverter
    • Axis
    • BeepRequest
    • Board
    • BoardClosedLoop
    • BoardState
    • Build
    • BuildObject
    • CPU
    • ClosedLoopCurrentFraction
    • ClosedLoopPositionError
    • Compatibility
    • CoreKinematics
    • CurrentMove
    • DSF
    • DeltaKinematics
    • DeltaTower
    • DeserializationFailedEventArgs
    • DeserializationFailedEventHandler
    • DirectDisplay
    • DirectDisplayController
    • DirectDisplayEncoder
    • DirectDisplayScreen
    • DirectDisplayScreenST7567
    • Directories
    • DistanceUnit
    • DistanceUnitConverter
    • Driver
    • DriverClosedLoop
    • Duet3DFilamentMonitor
    • Endstop
    • EndstopType
    • Extruder
    • ExtruderNonlinear
    • Fan
    • FanThermostaticControl
    • FilamentMonitor
    • FilamentMonitorEnableMode
    • FilamentMonitorStatus
    • FilamentMonitorType
    • GCodeFileInfo
    • GCodeFileInfoConverter
    • GpInputPort
    • GpOutputPort
    • HangprinterKinematics
    • Heat
    • Heater
    • HeaterModel
    • HeaterModelPID
    • HeaterMonitor
    • HeaterMonitorAction
    • HeaterMonitorCondition
    • HeaterState
    • HttpEndpoint
    • HttpEndpointType
    • IGrowingModelCollection
    • IModelCollection
    • IModelDictionary
    • IModelObject
    • InductiveSensor
    • InputChannel
    • InputChannelState
    • InputShaping
    • InputShapingType
    • Inputs
    • Job
    • KeepoutZone
    • KeepoutZoneCoordinates
    • Kinematics
    • KinematicsName
    • KinematicsNameConverter
    • LaserFilamentMonitor
    • LaserFilamentMonitorCalibrated
    • LaserFilamentMonitorConfigured
    • Layer
    • LedStrip
    • LedStripType
    • LimitedResponseCountAttribute
    • Limits
    • LogLevel
    • MachineMode
    • MachineStatus
    • Memory
    • Message
    • MessageBox
    • MessageBoxMode
    • MessageType
    • Microstepping
    • MinMaxCurrent<T>
    • ModelCollection<T>
    • ModelDictionaryConverter
    • ModelDictionary<TValue>
    • ModelGrowingCollection<T>
    • ModelObject
    • MotorsIdleControl
    • Move
    • MoveCalibration
    • MoveCompensation
    • MoveCompensationType
    • MoveDeviations
    • MoveQueueItem
    • MoveRotation
    • MoveSegmentation
    • Network
    • NetworkInterface
    • NetworkInterfaceType
    • NetworkProtocol
    • NetworkState
    • ObjectModel
    • ObjectModelConverter
    • Plugin
    • PluginManifest
    • PolarKinematics
    • Probe
    • ProbeGrid
    • ProbeType
    • PulsedFilamentMonitor
    • PulsedFilamentMonitorCalibrated
    • PulsedFilamentMonitorConfigured
    • RestorePoint
    • RotatingMagnetFilamentMonitor
    • RotatingMagnetFilamentMonitorCalibrated
    • RotatingMagnetFilamentMonitorConfigured
    • SBC
    • SbcPropertyAttribute
    • ScaraKinematics
    • Sensors
    • SessionType
    • Skew
    • Spindle
    • SpindleState
    • StartupError
    • State
    • TemperatureError
    • ThumbnailInfo
    • ThumbnailInfoFormat
    • TiltCorrection
    • TimesLeft
    • Tool
    • ToolRetraction
    • ToolState
    • UserSession
    • Volume
    • ZLeadscrewKinematics
  • DuetAPI.Utility
    • DriverId
    • DriverIdJsonConverter
    • FileLists
    • Heightmap
    • JsonCamelCaseStringEnumConverter
    • JsonCharEnumConverter
    • JsonHelper
    • JsonLowerCaseStringEnumConverter
    • JsonOptionalShortDateTimeConverter
    • JsonPolymorphicWriteOnlyConverter<T>
    • JsonRegexListConverter
    • JsonShortDateTimeConverter
    • RequiredPermissionsAttribute
    • SbcPermissions
    • SbcPermissionsConverter
  • DuetAPIClient
    • BaseCommandConnection
    • BaseConnection
    • CodeStreamConnection
    • CommandConnection
    • HttpEndpointConnection
    • HttpEndpointUnixSocket
    • HttpEndpointUnixSocket.EndpointRequestReceived
    • InterceptConnection
    • SubscribeConnection
  • DuetControlServer
    • Program
    • Settings
  • DuetControlServer.Codes
    • ChannelProcessor
    • PipelineStage
    • Processor
  • DuetControlServer.Codes.Handlers
    • Functions
    • GCodes
    • Keywords
    • MCodes
    • TCodes
  • DuetControlServer.Codes.Pipelines
    • Executed
    • Firmware
    • PipelineBase
    • PipelineStackItem
    • Post
    • Pre
    • ProcessInternally
    • Start
  • DuetControlServer.Commands
    • AddHttpEndpoint
    • AddUserSession
    • CheckPassword
    • Code
    • EvaluateExpression
    • Flush
    • GetFileInfo
    • GetObjectModel
    • IConnectionCommand
    • InstallPlugin
    • InstallSystemPackage
    • InvalidateChannel
    • LockObjectModel
    • PatchObjectModel
    • ReloadPlugin
    • RemoveHttpEndpoint
    • RemoveUserSession
    • ResolvePath
    • SetNetworkProtocol
    • SetObjectModel
    • SetPluginData
    • SetPluginProcess
    • SetUpdateStatus
    • SimpleCode
    • StartPlugin
    • StartPlugins
    • StopPlugin
    • StopPlugins
    • SyncObjectModel
    • UninstallPlugin
    • UninstallSystemPackage
    • UnlockObjectModel
    • WriteMessage
  • DuetControlServer.Files
    • CodeBlock
    • CodeFile
    • FileDirectory
    • FilePath
    • InfoParser
    • JobProcessor
    • MacroFile
  • DuetControlServer.Files.ImageProcessing
    • IconImageParser
    • ImageParser
    • ImageProcessingException
  • DuetControlServer.IPC
    • Connection
    • LockManager
    • Server
  • DuetControlServer.IPC.Processors
    • Base
    • CodeInterception
    • CodeStream
    • Command
    • ModelSubscription
    • PluginService
  • DuetControlServer.Model
    • Expressions
    • Expressions.CustomAsyncFunctionResolver
    • Filter
    • ItemPathNode
    • Observer
    • Observer.PropertyPathChanged
    • PeriodicUpdater
    • PropertyChangeType
    • Provider
    • Updater
  • DuetControlServer.SPI
    • DataTransfer
    • EvaluateExpressionRequest
    • Interface
    • Interface.MovementLock
    • VariableRequest
  • DuetControlServer.SPI.Channel
    • LockRequest
    • Manager
    • Processor
    • State
  • DuetControlServer.SPI.Communication
    • Consts
  • DuetControlServer.SPI.Communication.FirmwareRequests
    • AbortFileHeader
    • CodeBufferUpdateHeader
    • DoCodeHeader
    • EvaluationResultHeader
    • ExecuteMacroHeader
    • FileChunkHeader
    • FileHandleHeader
    • OpenFileHeader
    • PrintPausedHeader
    • PrintPausedReason
    • ReadFileHeader
    • Request
    • SeekFileHeader
  • DuetControlServer.SPI.Communication.SbcRequests
    • AssignFilamentHeader
    • BooleanHeader
    • CodeFlags
    • CodeHeader
    • CodeParameter
    • DeleteLocalVariableHeader
    • FileChunkHeader
    • FileDataHeader
    • GetObjectModelHeader
    • MacroCompleteHeader
    • OpenFileResult
    • PrintStartedHeader
    • PrintStoppedHeader
    • Request
    • SetObjectModelHeader
    • SetVariableHeader
  • DuetControlServer.SPI.Communication.Shared
    • CodeChannelHeader
    • DataType
    • HeightMapHeader
    • MessageHeader
    • MessageTypeFlags
    • PacketHeader
    • PrintStoppedReason
    • StringHeader
    • TransferHeader
    • TransferResponse
  • DuetControlServer.SPI.Serialization
    • Reader
    • Writer
  • DuetControlServer.Utility
    • BuildDateTimeAttribute
    • CRC16
    • CRC32
    • Firmware
    • Logger
    • PriorityThreadRunner
  • DuetWebServer
    • Program
    • Settings
    • Startup
  • DuetWebServer.Authorization
    • Policies
    • SessionKeyAuthenticationHandler
    • SessionKeyAuthenticationSchemeOptions
  • DuetWebServer.Controllers
    • MachineController
    • RepRapFirmwareController
    • WebSocketController
  • DuetWebServer.FileProviders
    • DuetFileProvider
  • DuetWebServer.Middleware
    • CustomEndpointMiddleware
    • FallbackMiddleware
    • FixContentTypeMiddleware
    • HttpEndpointConnection
  • DuetWebServer.Services
    • ModelObserver
    • SessionExpiry
  • DuetWebServer.Singletons
    • IModelProvider
    • IModelProvider.WebDirectoryChanged
    • ISessionStorage
    • ModelProvider
    • SessionStorage
  • DuetWebServer.Utility
    • CRC32

Class ModelDictionary<TValue>

Class for holding string keys and custom values

Inheritance
object
ModelDictionary<TValue>
Implements
IDictionary<string, TValue>
ICollection<KeyValuePair<string, TValue>>
IEnumerable<KeyValuePair<string, TValue>>
IModelDictionary
IModelObject
ICloneable
IDictionary
ICollection
IEnumerable
INotifyPropertyChanged
INotifyPropertyChanging
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: DuetAPI.ObjectModel
Assembly: DuetAPI.dll
Syntax
[JsonConverter(typeof(ModelDictionaryConverter))]
public sealed class ModelDictionary<TValue> : IDictionary<string, TValue>, ICollection<KeyValuePair<string, TValue>>, IEnumerable<KeyValuePair<string, TValue>>, IModelDictionary, IModelObject, ICloneable, IDictionary, ICollection, IEnumerable, INotifyPropertyChanged, INotifyPropertyChanging
Type Parameters
Name Description
TValue
Remarks

Key names are NOT converted to camel-case (unlike regular class properties)

Constructors

ModelDictionary(bool)

Constructor of this class

Declaration
public ModelDictionary(bool nullRemovesItems)
Parameters
Type Name Description
bool nullRemovesItems

Defines if setting items to null effectively removes them

Properties

Count

Returns the number of items in this collection

Declaration
public int Count { get; }
Property Value
Type Description
int

IsFixedSize

Whether this dictionary has a fixed size

Declaration
public bool IsFixedSize { get; }
Property Value
Type Description
bool

IsReadOnly

Whether the dictionary is read-only

Declaration
public bool IsReadOnly { get; }
Property Value
Type Description
bool

IsSynchronized

If this is thread-safe

Declaration
public bool IsSynchronized { get; }
Property Value
Type Description
bool

this[object]

Basic index operator

Declaration
public object this[object key] { get; set; }
Parameters
Type Name Description
object key

Key object

Property Value
Type Description
object

Value if found

this[string]

Index operator

Declaration
public TValue this[string key] { get; set; }
Parameters
Type Name Description
string key

Key

Property Value
Type Description
TValue

Value

Keys

List of keys

Declaration
public ICollection<string> Keys { get; }
Property Value
Type Description
ICollection<string>

NullRemovesItems

Flags if keys can be removed again by setting their value to null

Declaration
[JsonIgnore]
public bool NullRemovesItems { get; }
Property Value
Type Description
bool

SyncRoot

Synchronization root

Declaration
public object SyncRoot { get; }
Property Value
Type Description
object

Values

List of values

Declaration
public ICollection<TValue> Values { get; }
Property Value
Type Description
ICollection<TValue>

Methods

Add(KeyValuePair<string, TValue>)

Add a new item

Declaration
public void Add(KeyValuePair<string, TValue> item)
Parameters
Type Name Description
KeyValuePair<string, TValue> item

Item to add

Add(object, object?)

Add a new item

Declaration
public void Add(object key, object? value)
Parameters
Type Name Description
object key

Key to add

object value

Value to add

Add(string, TValue)

Add a new item

Declaration
public void Add(string key, TValue value)
Parameters
Type Name Description
string key

Key to add

TValue value

Value to add

Assign(object)

Assign the properties from another instance

Declaration
public void Assign(object from)
Parameters
Type Name Description
object from

Other instance

Clear()

Clear this dictionary

Declaration
public void Clear()

Clone()

Create a clone of this instance

Declaration
public object Clone()
Returns
Type Description
object

Contains(KeyValuePair<string, TValue>)

Check if a key-value pair exists

Declaration
public bool Contains(KeyValuePair<string, TValue> item)
Parameters
Type Name Description
KeyValuePair<string, TValue> item

Item to check

Returns
Type Description
bool

If the item exists in the dictionary

Contains(object)

Check if a key is present

Declaration
public bool Contains(object key)
Parameters
Type Name Description
object key

Key to check

Returns
Type Description
bool

Whether the key is present

ContainsKey(string)

Check if a key is present

Declaration
public bool ContainsKey(string key)
Parameters
Type Name Description
string key

Key to check

Returns
Type Description
bool

Whether the key is present

CopyTo(Array, int)

Copy this instance to another array

Declaration
public void CopyTo(Array array, int index)
Parameters
Type Name Description
Array array

Destination array

int index

Start index

CopyTo(KeyValuePair<string, TValue>[], int)

Copy this instance to another dictionary

Declaration
public void CopyTo(KeyValuePair<string, TValue>[] array, int arrayIndex)
Parameters
Type Name Description
KeyValuePair<string, TValue>[] array

Destination array

int arrayIndex

Start iondex

FindDifferences(IModelObject?)

Create a dictionary or list of all the differences between this instance and another. This method outputs own property values that differ from the other instance

Declaration
public object? FindDifferences(IModelObject? other)
Parameters
Type Name Description
IModelObject other

Other instance

Returns
Type Description
object

Object differences or null if both instances are equal

GetEnumerator()

Get an enumerator for this instance

Declaration
public IEnumerator<KeyValuePair<string, TValue>> GetEnumerator()
Returns
Type Description
IEnumerator<KeyValuePair<string, TValue>>

Enumerator instance

Remove(KeyValuePair<string, TValue>)

Remove a key-value pair if applicable

Declaration
public bool Remove(KeyValuePair<string, TValue> item)
Parameters
Type Name Description
KeyValuePair<string, TValue> item

Item to remove

Returns
Type Description
bool

If the key-value pair was present

Remove(object)

Remove a key (only supported if NullRemovesItems is true)

Declaration
public void Remove(object key)
Parameters
Type Name Description
object key

Key to remove

Remove(string)

Remove a key (only supported if NullRemovesItems is true)

Declaration
public bool Remove(string key)
Parameters
Type Name Description
string key

Key to remove

Returns
Type Description
bool

Whether the key could be found

TryGetValue(string, out TValue)

Try to get a value

Declaration
public bool TryGetValue(string key, out TValue value)
Parameters
Type Name Description
string key

Key to look up

TValue value

Retrieved value

Returns
Type Description
bool

Whether the key could be found

UpdateFromJson(JsonElement, bool)

Update this instance from a given JSON element

Declaration
public IModelObject? UpdateFromJson(JsonElement jsonElement, bool ignoreSbcProperties)
Parameters
Type Name Description
JsonElement jsonElement

Element to update this intance from

bool ignoreSbcProperties

Whether SBC properties are ignored

Returns
Type Description
IModelObject

Updated instance

Remarks

Accepts null as the JSON value to clear existing items

Exceptions
Type Condition
JsonException

Failed to deserialize data

Events

DictionaryCleared

Event that is called when the entire directory is cleared. Only used if NullRemovesItems is false

Declaration
public event EventHandler? DictionaryCleared
Event Type
Type Description
EventHandler

PropertyChanged

Event that is called when a key has been changed

Declaration
public event PropertyChangedEventHandler? PropertyChanged
Event Type
Type Description
PropertyChangedEventHandler

PropertyChanging

Event that is called when a key is being changed

Declaration
public event PropertyChangingEventHandler? PropertyChanging
Event Type
Type Description
PropertyChangingEventHandler

Implements

IDictionary<TKey, TValue>
ICollection<T>
IEnumerable<T>
IModelDictionary
IModelObject
ICloneable
IDictionary
ICollection
IEnumerable
INotifyPropertyChanged
INotifyPropertyChanging
In this article
Back to top Generated by DocFX