CLI相当于as关键字

CLI相当于as关键字

本文介绍了C ++ / CLI相当于as关键字?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在C ++ / CLI中表示此C#contruct?或者甚至可能是
吗?


PolicyLevel level =(enumerator-> Current)as PolicyLevel;


谢谢,

Karch

How would this C# contruct be represented in C++/CLI? Or is it even
possible?

PolicyLevel level = (enumerator->Current) as PolicyLevel;

Thanks,
Karch

推荐答案




PolicyLevel * level = dynamic_cast< PolicyLevel *>(enumerator-> Current);


C#中演员的等价物是__try_cast。


Arnaud

MVP - VC



PolicyLevel* level=dynamic_cast<PolicyLevel*>(enumerator->Current);

The equivalent of a cast in C# is __try_cast.

Arnaud
MVP - VC




PolicyLevel * level = dynamic_cast< PolicyLevel *>(枚举器 - >当前);

C#中的强制转换等效于__try_cast。

Arnaud
MVP - VC


PolicyLevel* level=dynamic_cast<PolicyLevel*>(enumerator->Current);

The equivalent of a cast in C# is __try_cast.

Arnaud
MVP - VC



是__try_cast c ++ / CLI还是托管c ++?或两者兼而有之?


is __try_cast c++/CLI or managed c++ ? Or both ?





托管C ++。对于C ++ / CLI,请使用safe_cast:检查MSDN以获取详细信息

(也称为RTFM)

Arnaud

MVP - VC



Managed C++. For C++/CLI, use safe_cast : Check MSDN for details
(a.k.a. RTFM)

Arnaud
MVP - VC


这篇关于C ++ / CLI相当于as关键字?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-20 05:01