Header menu logo DynamicObj

DynObj Module

This module contains lots of API functions for DynamicObj. These functions are not static methods on the DynamicObj type itself because that type is designed to be inherited from, and a lot of these functions might not make sense as static methods on inheriting types.

Functions and values

Function or value Description

combine first second

Full Usage: combine first second

Parameters:
Returns: DynamicObj

Combines the dynamic properties of the second DynamicObj onto the first. In case of duplicate property names the members of the second object override those of the first.

This function mutates the first input DynamicObj

first : DynamicObj

second : DynamicObj

Returns: DynamicObj

format dynObj

Full Usage: format dynObj

Parameters:
    dynObj : DynamicObj - The DynamicObj for which to generate a formatted string for

Returns: string

Returns a formatted string containing all static and dynamic properties of the given DynamicObj

dynObj : DynamicObj

The DynamicObj for which to generate a formatted string for

Returns: string

ofArray dynamicProperties

Full Usage: ofArray dynamicProperties

Parameters:
    dynamicProperties : (string * obj) array -

Returns: DynamicObj

Creates a new DynamicObj from an array of key value pairs containing dynamic properties.

dynamicProperties : (string * obj) array

Returns: DynamicObj

ofDict dynamicProperties

Full Usage: ofDict dynamicProperties

Parameters:
    dynamicProperties : Dictionary<string, obj> - The dictionary with the dynamic properties

Returns: DynamicObj

Creates a new DynamicObj from a Dictionary containing dynamic properties.

dynamicProperties : Dictionary<string, obj>

The dictionary with the dynamic properties

Returns: DynamicObj

ofList dynamicProperties

Full Usage: ofList dynamicProperties

Parameters:
    dynamicProperties : (string * obj) list -

Returns: DynamicObj

Creates a new DynamicObj from a list of key value pairs containing dynamic properties.

dynamicProperties : (string * obj) list

Returns: DynamicObj

ofSeq dynamicProperties

Full Usage: ofSeq dynamicProperties

Parameters:
    dynamicProperties : (string * obj) seq -

Returns: DynamicObj

Creates a new DynamicObj from a sequence of key value pairs containing dynamic properties.

dynamicProperties : (string * obj) seq

Returns: DynamicObj

print dynObj

Full Usage: print dynObj

Parameters:
    dynObj : DynamicObj - The DynamicObj for which to print a formatted string for

Prints a formatted string containing all static and dynamic properties of the given DynamicObj

dynObj : DynamicObj

The DynamicObj for which to print a formatted string for

removeProperty propertyName dynObj

Full Usage: removeProperty propertyName dynObj

Parameters:
    propertyName : string - The name of the property to remove
    dynObj : DynamicObj - The DynamicObj to remove the property from

Removes any dynamic property with the given name from the input DynamicObj. If the property is static and mutable, it will be set to null. Static immutable properties cannot be removed.

This function mutates the input DynamicObj

propertyName : string

The name of the property to remove

dynObj : DynamicObj

The DynamicObj to remove the property from

MemberAccessException Thrown if the dynamic property does not exist

setOptionalProperty propertyName propertyValue dynObj

Full Usage: setOptionalProperty propertyName propertyValue dynObj

Parameters:
    propertyName : string - The name of the property to set
    propertyValue : 'TPropertyValue option - The value of the property to set
    dynObj : DynamicObj - The DynamicObj to set the property on

Sets the dynamic (or static) property value with the given name on the given DynamicObj if the value is Some('TPropertyValue), creating a new dynamic property if none exists. If the given propertyValue is None, does nothing to the input DynamicObj.

This function mutates the input DynamicObj

propertyName : string

The name of the property to set

propertyValue : 'TPropertyValue option

The value of the property to set

dynObj : DynamicObj

The DynamicObj to set the property on

setOptionalPropertyBy propertyName propertyValue mapping dynObj

Full Usage: setOptionalPropertyBy propertyName propertyValue mapping dynObj

Parameters:
    propertyName : string - The name of the property to set
    propertyValue : 'TPropertyValue option - The value of the property to set
    mapping : 'TPropertyValue -> 'UPropertyValue - A function to apply to the property value before setting it on the DynamicObj
    dynObj : DynamicObj - The DynamicObj to set the property on

Sets the given dynamic (or static) property with the result of a mapping function applied to the given property value on the given DynamicObj if the value is Some('TPropertyValue). If the given propertyValue is None, does nothing to the input DynamicObj.

This function mutates the input DynamicObj

propertyName : string

The name of the property to set

propertyValue : 'TPropertyValue option

The value of the property to set

mapping : 'TPropertyValue -> 'UPropertyValue

A function to apply to the property value before setting it on the DynamicObj

dynObj : DynamicObj

The DynamicObj to set the property on

setProperty propertyName propertyValue dynObj

Full Usage: setProperty propertyName propertyValue dynObj

Parameters:
    propertyName : string - The name of the dynamic property to set
    propertyValue : 'TPropertyValue - The value of the dynamic property to set
    dynObj : DynamicObj - The DynamicObj to set the property on

Sets the dynamic (or static) property value with the given name on the given DynamicObj, creating a new dynamic property if none exists.

This function mutates the input DynamicObj

propertyName : string

The name of the dynamic property to set

propertyValue : 'TPropertyValue

The value of the dynamic property to set

dynObj : DynamicObj

The DynamicObj to set the property on

tryGetPropertyValue propertyName dynObj

Full Usage: tryGetPropertyValue propertyName dynObj

Parameters:
    propertyName : string - The name of the property to get
    dynObj : DynamicObj - The DynamicObj to get the property from

Returns: obj option

Returns Some(boxed property value) if a dynamic (or static) property with the given name exists on the input, otherwise None.

propertyName : string

The name of the property to get

dynObj : DynamicObj

The DynamicObj to get the property from

Returns: obj option

tryGetTypedPropertyValue propertyName dynObj

Full Usage: tryGetTypedPropertyValue propertyName dynObj

Parameters:
    propertyName : string - the name of the property to get
    dynObj : DynamicObj - the input DynamicObj

Returns: 'TPropertyValue option
Modifiers: inline
Type parameters: 'TPropertyValue

Returns Some('TPropertyValue) when a dynamic (or static) property with the given name and type exists on the input, otherwise None.

propertyName : string

the name of the property to get

dynObj : DynamicObj

the input DynamicObj

Returns: 'TPropertyValue option

withOptionalProperty propertyName propertyValue dynObj

Full Usage: withOptionalProperty propertyName propertyValue dynObj

Parameters:
    propertyName : string - The name of the property to set
    propertyValue : 'TPropertyValue option - The value of the property to set
    dynObj : 'a - The DynamicObj to set the property on

Returns: 'a
Modifiers: inline
Type parameters: 'TPropertyValue, 'a

Sets the dynamic (or static) property value with the given name on the given DynamicObj if the value is Some('TPropertyValue), creating a new dynamic property if none exists, and returns it. If the given propertyValue is None, does nothing to the input DynamicObj.

This function mutates the input DynamicObj

propertyName : string

The name of the property to set

propertyValue : 'TPropertyValue option

The value of the property to set

dynObj : 'a

The DynamicObj to set the property on

Returns: 'a

withOptionalPropertyBy propertyName propertyValue mapping dynObj

Full Usage: withOptionalPropertyBy propertyName propertyValue mapping dynObj

Parameters:
    propertyName : string - The name of the property to set
    propertyValue : 'TPropertyValue option - The value of the property to set
    mapping : 'TPropertyValue -> 'UPropertyValue - A function to apply to the property value before setting it on the DynamicObj
    dynObj : 'a - The DynamicObj to set the property on

Returns: 'a
Modifiers: inline
Type parameters: 'TPropertyValue, 'UPropertyValue, 'a

Sets the given dynamic (or static) property with the result of a mapping function applied to the given property value on the given DynamicObj if the value is Some('TPropertyValue) and returns it. If the given propertyValue is None, returns the unchanged DynamicObj.

This function mutates the input DynamicObj

propertyName : string

The name of the property to set

propertyValue : 'TPropertyValue option

The value of the property to set

mapping : 'TPropertyValue -> 'UPropertyValue

A function to apply to the property value before setting it on the DynamicObj

dynObj : 'a

The DynamicObj to set the property on

Returns: 'a

withProperty propertyName propertyValue dynObj

Full Usage: withProperty propertyName propertyValue dynObj

Parameters:
    propertyName : string - The name of the property to set
    propertyValue : 'TPropertyValue - The value of the property to set
    dynObj : 'a - The DynamicObj to set the property on

Returns: 'a
Modifiers: inline
Type parameters: 'TPropertyValue, 'a

Sets the dynamic (or static) property value with the given name, creating a new dynamic property if none exists on the given DynamicObj and returns it.

This function mutates the input DynamicObj

propertyName : string

The name of the property to set

propertyValue : 'TPropertyValue

The value of the property to set

dynObj : 'a

The DynamicObj to set the property on

Returns: 'a

withoutProperty propertyName dynObj

Full Usage: withoutProperty propertyName dynObj

Parameters:
    propertyName : string - The name of the property to remove
    dynObj : 'a - The DynamicObj to remove the property from

Returns: 'a
Modifiers: inline
Type parameters: 'a

Removes any dynamic property with the given name from the input DynamicObj and returns it. If the property is static and mutable, it will be set to null. Static immutable properties cannot be removed.

This function mutates the input DynamicObj

propertyName : string

The name of the property to remove

dynObj : 'a

The DynamicObj to remove the property from

Returns: 'a
MemberAccessException Thrown if the dynamic property does not exist

Type something to start searching.