c++/cli类型转换的问题
本帖最后由 sfwork 于 2012-10-13 10:14:43 编辑 最近在做一个C#和c++/cli混合编程的项目,在c#内部能正常运行的代码,在c++/cli里就报异常了,下面是c#代码:
public ORF_R04 ORF_R04_Parse(String message)
{
NHapi.Base.Parser.PipeParser Parser = new NHapi.Base.Parser.PipeParser();
NHapi.Base.Model.IMessage m = Parser.Parse(message);
//ORF_R04 orfr04 = m as ORF_R04;
ORF_R04 orfr04 = new ORF_R04();
orfr04 = (ORF_R04)m;
//orfr04 = m as ORF_R04;
return orfr04;
}
NHapi::Model::V24::Parser::MsgParser ^msgParser;
ORF_R04 ^orfr04 = msgParser->ORF_R04_Parse(message);