DynamicValue Class
Dynamic value (uses RuntimeBinding for ISymbol value reading / writing).
Inheritance Hierarchy
SystemObject
System.DynamicDynamicObject
TwinCAT.TypeSystemDynamicValue
TwinCAT.TypeSystemDynamicArrayValue
TwinCAT.TypeSystemDynamicEnumValue
TwinCAT.TypeSystemDynamicPointerValue
TwinCAT.TypeSystemDynamicReferenceValue
Namespace: TwinCAT.TypeSystem
Assembly: TwinCAT.Ads (in TwinCAT.Ads.dll)
Version: 7.0.0+e56d35ccc4675faac24789a4aab60071fc61d470
Syntax
C#
public class DynamicValue : DynamicObject,
IDynamicValue, IDynamicMetaObjectProvider, IValue, IStructValue, IArrayValueThe DynamicValue type exposes the following members.
Properties
|
|
Name |
Description |
|---|---|---|
|
|
Gets the age of the value (last successful read of the value) | |
|
|
Gets the cached Raw internal Data. | |
|
|
Gets the value of the cached field values | |
|
|
Gets the data type bound to this IValue | |
|
|
Gets a value indicating whether this IValue is a primitive value. | |
|
|
Gets the logger object | |
|
|
Gets the parent value. | |
|
|
Gets the resolved type. | |
|
|
Gets the symbol that is bound to this value. | |
|
|
Gets the Time stamp of the last successful read of the Value. | |
|
|
Gets / Sets the update mode | |
|
|
The value factory |
Methods
|
|
Name |
Description |
|---|---|---|
|
|
Determines whether the used logger is enabled for the specified log level. | |
|
|
Determines whether the specified object is equal to the current
object. | |
|
|
Allows an object to try to free resources and perform other
cleanup operations before it is reclaimed by garbage
collection. | |
|
|
Returns the enumeration of all dynamic member names. | |
|
|
Serves as the default hash function. | |
|
|
Provides a DynamicMetaObject
that dispatches to the dynamic virtual methods. The object can be
encapsulated inside another DynamicMetaObject to
provide custom behavior for individual actions. This method
supports the Dynamic Language Runtime infrastructure for language
implementers and it is not intended to be used directly from your
code. | |
|
|
Gets the Type of the current
instance. | |
|
|
Creates a shallow copy of the current Object. | |
|
|
Reads the value (via ADS) | |
|
|
read as an asynchronous operation. | |
|
|
Resolves the Value object to its primitive value. | |
|
|
Writes the specified member element. | |
|
|
Returns a String that represents this
instance. | |
|
|
Provides implementation for binary operations. Classes derived
from the DynamicObject class
can override this method to specify dynamic behavior for operations
such as addition and multiplication. | |
|
|
Provides implementation for type conversion operations. Classes
derived from the DynamicObject class
can override this method to specify dynamic behavior for operations
that convert an object from one type to another. | |
|
|
Provides the implementation for operations that initialize a
new instance of a dynamic object. This method is not intended for
use in C# or Visual Basic. | |
|
|
Provides the implementation for operations that delete an
object by index. This method is not intended for use in C# or
Visual Basic. | |
|
|
Provides the implementation for operations that delete an
object member. This method is not intended for use in C# or Visual
Basic. | |
|
|
Returns Array Element values. | |
|
|
Provides the implementation for operations that get a value by
index. Classes derived from the DynamicObject class
can override this method to specify dynamic behavior for indexing
operations. | |
|
|
Reads the specified array element. | |
|
|
Tries the get index value. | |
|
|
Provides the implementation for operations that get member
values. Classes derived from the DynamicObject class
can override this method to specify dynamic behavior for operations
such as getting a value for a property. | |
|
|
Tries the get member value. | |
|
|
Provides the implementation for operations that invoke an
object. Classes derived from the DynamicObject class
can override this method to specify dynamic behavior for operations
such as invoking an object or a delegate. | |
|
|
Provides the implementation for operations that invoke a
member. Classes derived from the DynamicObject class
can override this method to specify dynamic behavior for operations
such as calling a method. | |
|
|
Tries to resolves the Value object to its primitive value. | |
|
|
Provides the implementation for operations that set a value by
index. Classes derived from the DynamicObject class
can override this method to specify dynamic behavior for operations
that access objects by a specified index. | |
|
|
Tries to set the indexed value on Arrays | |
|
|
Tries to set the indexed value on Arrays | |
|
|
Provides the implementation for operations that set member
values. Classes derived from the DynamicObject class
can override this method to specify dynamic behavior for operations
such as setting a value for a property. | |
|
|
Tries to Set a Member/Property Value | |
|
|
Provides implementation for unary operations. Classes derived
from the DynamicObject class
can override this method to specify dynamic behavior for operations
such as negation, increment, or decrement. | |
|
|
Writes the value (via ADS) | |
|
|
write as an asynchronous operation. |
Fields
|
|
Name |
Description |
|---|---|---|
|
|
The cached (raw) data) of the Root Symbol | |
|
|
The cached raw static value |
Remarks
The DynamicValue adds dynamic run time behaviour to the IValueValue/IValue. That means e.g. for struct values that .NET Properties are on-the-fly defined and dispatched at runtime just like defined in the structs structs data type definition. Another example is the access of Array Element values through indexes.
Example
Sample for the dynamic resolution of Symbols and reading values:
Dynamic Symbol access
/// <summary>
/// Defines the entry point of the application.
/// </summary>
/// <param name="args">The arguments.</param>
static async void Main(string[] args)
{
// Get the AdsAddress from command-line arguments
AmsAddress address = ArgParser.Parse(args);
CancellationTokenSource cancelSource = new CancellationTokenSource();
CancellationToken cancel = cancelSource.Token;
using (AdsClient client = new AdsClient())
{
// Connect to the target device
client.Connect(address);
// Usage of "dynamic" Type and Symbols (>= .NET4 only)
SymbolLoaderSettings settings = new SymbolLoaderSettings(SymbolsLoadMode.DynamicTree);
IAdsSymbolLoader dynLoader = (IAdsSymbolLoader)SymbolLoaderFactory.Create(client, settings);Reference
TwinCAT.TypeSystem Namespace DynamicSymbol DynamicObject IValue
Beckhoff Automation GmbH & Co. KG 2001-2026
- DynamicValue.Age Property
- DynamicValue.CachedRaw Property
- DynamicValue.DataType Property
- DynamicValue.IsPrimitive Property
- DynamicValue.ResolvedType Property
- DynamicValue.Symbol Property
- DynamicValue.TimeStamp Property
- DynamicValue.UpdateMode Property
- DynamicValue.ValueFactory Property
- DynamicValue.ParentValue Property
- DynamicValue.GetDynamicMemberNames Method
- DynamicValue.Read Method
- DynamicValue.ReadAsync Method
- DynamicValue.ReadMember Method
- DynamicValue.ResolveValue Method
- DynamicValue.ToString Method
- DynamicValue.TryConvert Method
- DynamicValue.TryGetArrayElementValues Method
- DynamicValue.TryGetIndex Method
- DynamicValue.TryGetIndexValue Method (.Int32., Object.)
- DynamicValue.TryGetIndexValue Method (.Object., Object.)
- DynamicValue.TryGetMember Method
- DynamicValue.TryGetMemberValue Method
- DynamicValue.TryInvoke Method
- DynamicValue.TryInvokeMember Method
- DynamicValue.TryResolveValue Method
- DynamicValue.TrySetIndex Method
- DynamicValue.TrySetIndexValue Method
- DynamicValue.TrySetMember Method
- DynamicValue.TrySetMemberValue Method
- DynamicValue.Write Method
- DynamicValue.WriteAsync Method
- DynamicValue.WriteMember Method
- DynamicValue.setMemberValue Method
- DynamicValue.TrySetIndexValue Method (.Int32., Object)
- DynamicValue.TrySetIndexValue Method (.Object., Object)