AssemblyInfo.cs中C#程序中的GUID是什么? [英] What does the GUID in C# Programs in the AssemblyInfo.cs?

查看:98
本文介绍了AssemblyInfo.cs中C#程序中的GUID是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道C#程序中AssemblyInfo.cs中的GUID是什么: [assembly:Guid("a4df9f47-b2d9-49a9-b237-09220857c051")]

I'm wondering for what the GUID in the AssemblyInfo.cs in C# Programs is: [assembly: Guid("a4df9f47-b2d9-49a9-b237-09220857c051")]

评论说它是针对COM对象的,但是为什么它们需要GUID?GUID可以从外部访问吗?

The commentary says it's for COM objects, but why do they need a GUID? Is the GUID accessibly externally?

因此,如果仅用于COM,则在设置 [assembly:ComVisible(false)] 时是否需要GUID?

So if it's only for COMs, do you need a GUID when you set [assembly: ComVisible(false)]?

推荐答案

Guid(全局唯一标识符)用于通过外界识别您的组件.当编写要用作COM(组件对象模型)的项目时,必须指定一个唯一的名称.因此,您需要应用GUID属性.

Guid (Globally unique identifier) is used to identify your component by outside world. When you write a project which is going to be used as COM (Component Object Model) you will have to give a unique name. For this reason you need to apply GUID attribute.

更多信息,请访问 http://msdn.microsoft.com/en-us/library/system.runtime.interopservices.guidattribute.aspx

如果您不会在程序集级别将其作为COM公开,则可以将其删除

You can remove it if you won't be exposing it as COM on assembly level

这篇关于AssemblyInfo.cs中C#程序中的GUID是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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