比较GUID [英] Comparing GUIDs

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

问题描述

你好 -


我在比较2个guid时遇到了一个奇怪的问题。在我的审判中,

他们不相等。当我逐步执行(VB.NET)代码时,它们被评估为相等,当我在命令窗口中输入比较时,

它们不是等于。我非常难过这个。请帮忙。


我尝试了以下结构,结果相同:


guid1.equals(guid2)

guid1.tostring.equals(guid2.tostring)

guid1.tostring = guid2.tostring


2个指南是:


guid1 = 2a14ce02-20c1-11c4-8000-8ea6b5cb2452

guid2 = 007900d7-009c-00e1-f100-7900fc002900


(显然不一样)


这些是我在命令

窗口中输入?guid1和?guid2时报告的值。当我在命令窗口中输入上述任何结构(例如,

?guid1.equals(guid2))时,会正确返回False。


但是在我的代码中,我有声明:


如果guid1.equals(guid2)然后X


和X执行!


这里可能有什么问题?


感谢您的帮助。


- Jeff

Hi -

I''m experiencing a strange problem when comparing 2 guids. In my trial,
they''re not equal. When I step through the (VB.NET) code, they are
evaluated as equal, and when I enter the comparison in the command window,
they''re not equal. I''m pretty stumped on this one. Please help.

I''ve tried the following structures, all with the same result:

guid1.equals(guid2)
guid1.tostring.equals(guid2.tostring)
guid1.tostring = guid2.tostring

The 2 guids are:

guid1 = 2a14ce02-20c1-11c4-8000-8ea6b5cb2452
guid2 = 007900d7-009c-00e1-f100-7900fc002900

(obviously not the same)

Those are the values reported when I type ?guid1 and ?guid2 into the command
window. When I enter any of the above structures (e.g.,
?guid1.equals(guid2)) into the command window, False is correctly returned.

But in my code, I have the statement:

if guid1.equals(guid2) then X

and X is executed!

What could be wrong here??

Thanks for any help.

- Jeff

推荐答案

" Jeff" < JE ********* @ eNetPortals.com> schrieb
"Jeff" <je*********@eNetPortals.com> schrieb
嗨 -

我在比较2个guid时遇到了一个奇怪的问题。在我的
审判中,他们并不平等。当我逐步执行(VB.NET)代码时,
它们被评估为相等,当我在
命令窗口中输入比较时,它们不相等。我非常难过这个。
请帮忙。

我尝试了以下结构,所有结果都相同:

guid1。 equals(guid2)
guid1.tostring.equals(guid2.tostring)
guid1.tostring = guid2.tostring

2个指南是:

guid1 = 2a14ce02-20c1-11c4-8000-8ea6b5cb2452
guid2 = 007900d7-009c-00e1-f100-7900fc002900

(显然不一样)

这些是当我在
命令窗口中输入?guid1和?guid2时报告的值。当我在命令窗口中输入上述任何结构(例如,
?guid1.equals(guid2))时,会正确返回False。

但在我的代码中,我有声明:

如果guid1.equals(guid2)然后X和/或
和X被执行了!

这里有什么问题?
Hi -

I''m experiencing a strange problem when comparing 2 guids. In my
trial, they''re not equal. When I step through the (VB.NET) code,
they are evaluated as equal, and when I enter the comparison in the
command window, they''re not equal. I''m pretty stumped on this one.
Please help.

I''ve tried the following structures, all with the same result:

guid1.equals(guid2)
guid1.tostring.equals(guid2.tostring)
guid1.tostring = guid2.tostring

The 2 guids are:

guid1 = 2a14ce02-20c1-11c4-8000-8ea6b5cb2452
guid2 = 007900d7-009c-00e1-f100-7900fc002900

(obviously not the same)

Those are the values reported when I type ?guid1 and ?guid2 into the
command window. When I enter any of the above structures (e.g.,
?guid1.equals(guid2)) into the command window, False is correctly
returned.

But in my code, I have the statement:

if guid1.equals(guid2) then X

and X is executed!

What could be wrong here??



你确定它已被执行了吗?我不这么认为。


如果你不能进入X,试试这个:


如果是guid1.equals( guid2)然后msgbox等于


我猜你没看到msgbox。


-

Armin


如何报价以及原因:
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html


Are you sure it is executed? I don''t think so.

If you can''t step into X, try this:

if guid1.equals(guid2) then msgbox "equal"

I guess you don''t see a msgbox.

--
Armin

How to quote and why:
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html


谢谢,阿明 -


你是对的!但仍有一些有趣的东西。发生:


在我的代码中,我有2行:

如果guid1是system.dbnull.value那么
然后Y

如果guid1.equals(guid2)那么X


这两个条件都评估为false。如果我单步执行代码,Y不会突出显示
,但X是(即使它没有执行)。


这肯定不是对我来说更长的时间(再次感谢)。但是我想知道为什么调试的行为如上所述。


- Jeff

" Armin Zingler" < AZ ******* @ freenet.de>在消息中写道

news:40 ********************* @ news.freenet.de ...
Thanks, Armin -

You''re right! But there''s still something "interesting" happening:

In my code, I have 2 lines:

if guid1 is system.dbnull.value then Y
if guid1.equals(guid2) then X

Both conditions evaluate as false. If I step through the code, Y is not
highlighted, but X is (even though it doesn''t execute).

This is certainly no longer a showstopper for me (thanks again). But I''m
wondering why debugging behaves as above.

- Jeff
"Armin Zingler" <az*******@freenet.de> wrote in message
news:40*********************@news.freenet.de...
杰夫 < JE ********* @ eNetPortals.com> schrieb
"Jeff" <je*********@eNetPortals.com> schrieb
嗨 -

我在比较2个guid时遇到了一个奇怪的问题。在我的
审判中,他们并不平等。当我逐步执行(VB.NET)代码时,
它们被评估为相等,当我在
命令窗口中输入比较时,它们不相等。我非常难过这个。
请帮忙。

我尝试了以下结构,所有结果都相同:

guid1。 equals(guid2)
guid1.tostring.equals(guid2.tostring)
guid1.tostring = guid2.tostring

2个指南是:

guid1 = 2a14ce02-20c1-11c4-8000-8ea6b5cb2452
guid2 = 007900d7-009c-00e1-f100-7900fc002900

(显然不一样)

这些是当我在
命令窗口中输入?guid1和?guid2时报告的值。当我在命令窗口中输入上述任何结构(例如,
?guid1.equals(guid2))时,会正确返回False。

但在我的代码中,我有声明:

如果guid1.equals(guid2)然后X和/或
和X被执行了!

这里有什么问题?
Hi -

I''m experiencing a strange problem when comparing 2 guids. In my
trial, they''re not equal. When I step through the (VB.NET) code,
they are evaluated as equal, and when I enter the comparison in the
command window, they''re not equal. I''m pretty stumped on this one.
Please help.

I''ve tried the following structures, all with the same result:

guid1.equals(guid2)
guid1.tostring.equals(guid2.tostring)
guid1.tostring = guid2.tostring

The 2 guids are:

guid1 = 2a14ce02-20c1-11c4-8000-8ea6b5cb2452
guid2 = 007900d7-009c-00e1-f100-7900fc002900

(obviously not the same)

Those are the values reported when I type ?guid1 and ?guid2 into the
command window. When I enter any of the above structures (e.g.,
?guid1.equals(guid2)) into the command window, False is correctly
returned.

But in my code, I have the statement:

if guid1.equals(guid2) then X

and X is executed!

What could be wrong here??



你确定它已被执行了吗?我不这么认为。

如果你不能进入X,试试这个:

如果guid1.equals(guid2)那么msgbox等于

我猜你没看到一个msgbox。

-
Armin

如何报价以及为什么:
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news /learn2quote.html



" Jeff" < JE ********* @ eNetPortals.com> schrieb
"Jeff" <je*********@eNetPortals.com> schrieb
但在我的代码中,我有声明:

如果guid1.equals(guid2)然后X和/或X被执行了!

这里有什么问题?
But in my code, I have the statement:

if guid1.equals(guid2) then X

and X is executed!

What could be wrong here??



你确定它被执行了吗?我不这么认为。

如果你不能进入X,试试这个:

如果guid1.equals(guid2)那么msgbox等于

我猜你没看到msgbox。


Are you sure it is executed? I don''t think so.

If you can''t step into X, try this:

if guid1.equals(guid2) then msgbox "equal"

I guess you don''t see a msgbox.



你是对的!但是仍然有一些有趣的事情发生了:

在我的代码中,我有两行:

如果guid1是system.dbnull.value然后Y
如果guid1.equals(guid2)然后X

两个条件都评估为假。如果我单步执行代码,Y不会突出显示,但是X是(即使它没有执行)。



You''re right! But there''s still something "interesting"
happening:

In my code, I have 2 lines:

if guid1 is system.dbnull.value then Y
if guid1.equals(guid2) then X

Both conditions evaluate as false. If I step through the code, Y is
not highlighted, but X is (even though it doesn''t execute).



这段代码甚至无法编译。 Is运算符不能与

值类型一起使用,但GUID是值类型。你是怎么宣布guid1和guid2的?

我宣称它们是GUID。

-

Armin


如何引用及其原因:
http:// www .plig.net / nnq / nquote.html
http://www.netmeister.org/news/learn2quote.html


This code can not even be compiled. The Is operator must not be used with
value types, but GUID is a value type. How did you declare guid1 and guid2?
I declared them as GUID.
--
Armin

How to quote and why:
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html


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

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