将接口 IDL 文件转换为 C# [英] Convert Interface IDL file to C#

查看:20
本文介绍了将接口 IDL 文件转换为 C#的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 IDL 文件中定义了一个接口,我想在 C# 中使用它.有没有办法将 IDL 转换为 C# 中可用的内容?

I have an interface defined in an IDL file that I would like to use in C#. Is there a way to convert the IDL to something usable in C#?

推荐答案

一种方法是在 IDL 上运行 MIDL 以创建类型库 (.tlb).这需要 IDL 中的 library 块.获得 .tlb 后,您可以在其上运行 tlbimp.exe 以获取 C# 定义/互操作 DLL.

One way is to run MIDL on the IDL to create a type library (.tlb). This requires a library block in the IDL. Once you have the .tlb, you can run tlbimp.exe on it to get a C# definition/Interop DLL.

这篇关于将接口 IDL 文件转换为 C#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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