Show / Hide Table of Contents

Method CastTo

CastTo(ArcadeExpressionReturnType)

Cast the result of an evaluation to another type using the Arcade casting rules.

Declaration
public object CastTo(ArcadeExpressionReturnType type)
Parameters
Type Name Description
ArcadeExpressionReturnType type

The type to cast to.

Returns
Type Description
System.Object

An object of the requested type or null.

Remarks

Use to ensure that the final return value from a script is cast to an expected type in an Arcade-consistent manner. For more information on the casting behavior for each type, see ArcadeExpressionReturnType. Only types to which a value can be cast are available in ArcadeExpressionReturnType. Other types, such as GeoElement, should be accessed via the result property. An exception is not thrown when casting fails. Instead, a type-specific error value is returned whose value depends on the type of cast attempted.

Applies to

Platforms and versions
TargetVersions
.NET Standard 2.0100.14 - 200.8
.NET100.14 - 200.8
.NET Windows100.14 - 200.8
.NET Android200.0 - 200.8
.NET iOS200.0 - 200.8
.NET Framework100.14 - 200.8
Xamarin.Android100.14 - 100.15
Xamarin.iOS100.14 - 100.15
UWP100.14 - 200.8
In This Article
Back to top Copyright © 2022 Esri.