ReferenceEquals(object obj1,object obj2)的参数如何通过DateTime.ReferenceEquals()工作,我们可以将数据存储在其中一个控件文本框中。 [英] how argument of ReferenceEquals(object obj1,object obj2) works so by DateTime.ReferenceEquals() we can store the data in one of the control textbox.

查看:53
本文介绍了ReferenceEquals(object obj1,object obj2)的参数如何通过DateTime.ReferenceEquals()工作,我们可以将数据存储在其中一个控件文本框中。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

推荐答案

首先,这个问题毫无意义。该函数只返回Boolean。用这个结果做你想要的。但对于System.DateTime来说也没有任何意义。



这是一个非常有趣的故事。对于值类型,此函数始终返回false。我想,因为这些类型不是引用类型。 System.DateTime当然是值类型。试试这个:

First of all, this question makes no sense. This function simply returns Boolean. Do with this result what you want. But it also makes no sense, for System.DateTime.

This is a pretty funny story. This function always return false for value types. I guess, because these types are not reference types. System.DateTime is of course the value type. Try this:
int value1 = 1;
int value2 = 1;
bool sameValue = int.ReferenceEquals(value1, value2); // no wonder
// this is funnier:
bool sameObject = int.ReferenceEquals(value2, value2);



在这两种情况下,sameValue和sameObject都是false(!)。



-SA


这篇关于ReferenceEquals(object obj1,object obj2)的参数如何通过DateTime.ReferenceEquals()工作,我们可以将数据存储在其中一个控件文本框中。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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