开发者

How to handle Variant Missing

I'm new in C# world. I have a COM server written in C++ and in some situation it returns a variant_t::missing(). When I try to receive that value in C开发者_开发知识库#:

object a;
a = comServer.Value // Value returns missing

it throws a exception that I cannot event handle in C#.

How I should do?


Wrap it in a try / catch:

try 
{
    object a = comServer.Value;
}
catch (Exception ex)
{
    // handle the error
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜