Training
Module
Convert data types using casting and conversion techniques in C# - Training
Explore using C# techniques for casts and conversions.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Value.As(value as any, type as type) as any
Returns the value if it's compatible with the specified type. This is equivalent to the "as" operator in M, with the exception that it can accept identifier type references such as Number.Type.
Cast a number to a number.
Usage
Value.As(123, Number.Type)
Output
123
Attempt to cast a text value to a number.
Usage
Value.As("abc", type number)
Output
[Expression.Error] We cannot convert the value "abc" to type Number.
Training
Module
Convert data types using casting and conversion techniques in C# - Training
Explore using C# techniques for casts and conversions.