as

March 24, 2026 ยท View on GitHub

Shows how to use xtd::unsafe::as operator.

Sources

Build and run

Open "Command Prompt" or "Terminal". Navigate to the folder that contains the project and type the following:

xtdc run

Output

C++ cast :
  i => 1144201745
  s => "@\317r"
  s => (null)

Unsafe cast :
  i => 1144201745
  s => "@\317r"

Safe cast :
  366216421905 is greater than 2147483647
  xtd::date_time* is not a xtd::string*

Convert :
  366216421905 is greater than 2147483647
  xtd::date_time* is not a xtd::string*