C ++ / CLI相当于as关键字? [英] C++/CLI equivalent to as keyword?

查看:86
本文介绍了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

推荐答案



karch写道:

karch wrote:
这个C#contruct如何在C ++ / CLI中表示?或者甚至可能吗?

PolicyLevel level =(enumerator-> Current)as PolicyLevel;
How would this C# contruct be represented in C++/CLI? Or is it even
possible?

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




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


ad ****** @ club-internet.fr schrieb:
karch写道:
karch wrote:
这个C#如何构成用C ++ / CLI表示?或者甚至可能吗?

PolicyLevel level =(enumerator-> Current)as PolicyLevel;
How would this C# contruct be represented in C++/CLI? Or is it even
possible?

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



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 ?




bonk写道:

bonk wrote:
是__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关键字?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆