问题有点不对,所以抱歉,先生 [英] question little wrong so sorry sir

查看:65
本文介绍了问题有点不对,所以抱歉,先生的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

ReferenceEquals(对象obj1,对象obj2)的参数是如何工作的,通过DateTime.ReferenceEquals()我们可以将数据存储在一个控制文本框中。

解决方案

尝试msdn链接 - http://msdn.microsoft.com/en-us/library/system.object.referenceequals%28v=vs.110%29.aspx [ ^ ]。



比较值类型时。如果objA和objB是值类型,则在将它们传递给ReferenceEquals方法之前将它们装箱。这意味着如果objA和objB都表示相同的实例如果是值类型,则ReferenceEquals方法返回false,如下例所示。



比较字符串时。如果objA和objB是字符串,则ReferenceEquals方法返回rns如果字符串是实例,则为true。它不执行值相等的测试。在以下示例中,s1和s2相等,因为它们是单个实习字符串的两个实例。但是,s3和s4不相等,因为尽管它们具有相同的字符串值,但该字符串不会被实现。

how argument of ReferenceEquals(object obj1,object obj2) works so by DateTime.ReferenceEquals() we can store the data in one of the control textbox.

解决方案

Try the msdn link - http://msdn.microsoft.com/en-us/library/system.object.referenceequals%28v=vs.110%29.aspx[^].

"When comparing value types. If objA and objB are value types, they are boxed before they are passed to the ReferenceEquals method. This means that if both objA and objB represent the same instance of a value type, the ReferenceEquals method nevertheless returns false, as the following example shows.

When comparing strings. If objA and objB are strings, the ReferenceEquals method returns true if the string is interned. It does not perform a test for value equality. In the following example, s1 and s2 are equal because they are two instances of a single interned string. However, s3 and s4 are not equal, because although they are have identical string values, that string is not interned. "


这篇关于问题有点不对,所以抱歉,先生的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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