DllImport来调用类 [英] DllImport to call class

查看:121
本文介绍了DllImport来调用类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

HI,

我知道使用dllImport从dll调用方法是可行的

但是,如果我需要使用类名来获取和设置例如:




I know that is posible to call methods from a dll using dllImport
But, If I need to use the class name for a get and a set like:

private ClassName myClassName;
        public ClassName  m_myClassName
        {
            get { return myClassName; }
            set { myClassName= value; }
        }







如何拨打该课程?



谢谢




How can I call that class?

Thanks

推荐答案

您不需要DLLImport来访问.NET类 - DLLImport适用于的外部资源 .NET,但原生。



对于.NET资源,只需在项目中添加对程序集的引用,为命名空间添加适当的using语句,并直接访问该类。
You don't need DLLImport to access .NET classes - DLLImport is for external resources that are not .NET, but native.

For .NET resources, just add a reference to the assembly in your project, add the appropriate using statement for the namespace, and access the class directly.


这篇关于DllImport来调用类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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