为什么GUID属性需要摆在首位? [英] Why is GUID attribute needed in the first place?

查看:122
本文介绍了为什么GUID属性需要摆在首位?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

什么是必要的GUID属性?为什么不只是让编译程序自动处理这个?!

What is the necessity for the GUID attribute? why don't just let the compiler handle this automatically?!

推荐答案

如果编译器自动处理这一点,你会落得两种情况之一。

If the compiler handled this automatically, you'd end up with one of two situations.

  • 一个新的GUID每次编译 - 因为GUID的都应该公布,这将失败

  • A new GUID every time you compiled - since GUIDs are supposed to be published, this would fail.

碰撞 - 如果GUID是相同的每一次,基于名称的(说)一个Hash,多个项目最终将使用相同​​的GUID用于不同的目的。

Collisions - if the GUID was the same every time, based on (say) a Hash of the name, multiple projects would end up using the same GUID for different purposes.

现有的方法 - 一个明确的GUID使开发人员根据需要控制这些电力

The existing approach - an explicit GUID gives developers the power to control these as required.

这篇关于为什么GUID属性需要摆在首位?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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