为什么以及何时应该让我的程序集对 Com Components 可见?
Why and When should I make my assembly visible to Com Components?
我有一个 Mvc 应用程序,我有这个选项:
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
不知道这个能做什么,是不是安全设置?
何时 select ComVisible(false) 以及何时 ComVisible(true)?
我搜索 Com 组件,了解这是什么,我找到了这个定义:
Component Object Model (COM) is a binary-interface standard for
software components introduced by Microsoft in 1993. It is used to
enable inter-process communication and dynamic object creation in a
large range of programming languages. COM is the basis for several
other Microsoft technologies and frameworks, including OLE, OLE
Automation, ActiveX, COM+, DCOM, the Windows shell, DirectX, UMDF and
Windows Runtime.
这对我来说意味着 Com 组件是应用程序之间通信的一种方式,但我不确定我对这个定义的理解是否正确。
你能用简单的话(例子)告诉我,为什么以及什么时候我应该使 ComVisible(真)?
当您需要将程序集中的 public 方法和函数公开给其他不是用 .NET 编写的应用程序时,您可以将 ComVisible 属性 设置为 true,然后这些应用程序可以使用您的程序中的功能使用 Microsoft 的 COM 进行组装,这是一种在运行时绑定到组件的标准化接口。
我有一个 Mvc 应用程序,我有这个选项:
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
不知道这个能做什么,是不是安全设置?
何时 select ComVisible(false) 以及何时 ComVisible(true)?
我搜索 Com 组件,了解这是什么,我找到了这个定义:
Component Object Model (COM) is a binary-interface standard for software components introduced by Microsoft in 1993. It is used to enable inter-process communication and dynamic object creation in a large range of programming languages. COM is the basis for several other Microsoft technologies and frameworks, including OLE, OLE Automation, ActiveX, COM+, DCOM, the Windows shell, DirectX, UMDF and Windows Runtime.
这对我来说意味着 Com 组件是应用程序之间通信的一种方式,但我不确定我对这个定义的理解是否正确。
你能用简单的话(例子)告诉我,为什么以及什么时候我应该使 ComVisible(真)?
当您需要将程序集中的 public 方法和函数公开给其他不是用 .NET 编写的应用程序时,您可以将 ComVisible 属性 设置为 true,然后这些应用程序可以使用您的程序中的功能使用 Microsoft 的 COM 进行组装,这是一种在运行时绑定到组件的标准化接口。