-
Notifications
You must be signed in to change notification settings - Fork 1
ValueContainer
The ValueContainer class is used to store values used in a Power Automate flow. Power Automate uses types throughout a flow, but it uses them loosely, so you never know which type will appear when. The ValueContainer has been created to deal with this, to abstract the types away.
So in general, a ValueContainer is just the value wrapped in an object and it can be of any type at any time.
The types from Power Automate is:
- String (string)
- Float (double)
- Integer (int)
- Boolean (bool)
- List (IEnumerable)
- Object (Dictionary<string, ValueContainer>)
There is a constructor for each type mentioned above.
There is a constructor that tries to parse a string to a type mentioned above, fallbacks to string. new ValueContainer("2.1", true) results to a value container with type Float and value 2.1.
There is a constructor, which constructs a ValueContainer object from a JToken, it is overloaded to use IExpressionEngine to parse string expressions while creating the ValueContainer. If the IExpressionEngine is not present, expression will not be parsed.
To make it easier to use for you, ValueContainer extends the IComparable and IEquatable interface. NOTE: When comparing floats, difference greater than first decimal is ignored
Furthermore, the Indexers have been implemeted for both lists and objects.