473,662 Members | 2,375 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Difference? myDate.Equals(D ate.MinValue) -or- myDate = Date.MinValue

Hello,
what is the difference and what is better (performance etc) ?

a) If myDate.Equals(D ate.MinValue)
b) If myDate = Date.MinValue

Thanks,
Andreas
Nov 17 '05 #1
3 1526
Don't know about VB but in C# the operator calls the function. Depending on
the compiler the function might be faster (but most likely it will be the
same as the compiler will do the substitution, much like inline functions in
C++).

Jerry

"Andreas Klemt" <ak******@hotma il.com> wrote in message
news:%2******** ********@TK2MSF TNGP09.phx.gbl. ..
Hello,
what is the difference and what is better (performance etc) ?

a) If myDate.Equals(D ate.MinValue)
b) If myDate = Date.MinValue

Thanks,
Andreas

Nov 17 '05 #2
Hello,

results are:

a) If myDate.Equals(D ate.MinValue)
0,007439

b) If myDate = Date.MinValue
0,002253

Regards,
Andreas
"MS News (MS ILM)" <sq**********@h otmail.com> schrieb im Newsbeitrag
news:eD******** ******@tk2msftn gp13.phx.gbl...
Time stamp it
Run a loop 1000000000 times and see which one is better
Please let us know
"Andreas Klemt" <ak******@hotma il.com> wrote in message
news:%2******** ********@TK2MSF TNGP09.phx.gbl. ..
Hello,
what is the difference and what is better (performance etc) ?

a) If myDate.Equals(D ate.MinValue)
b) If myDate = Date.MinValue

Thanks,
Andreas


Nov 17 '05 #3
Take a look in IL and you will see that CLR use Boxing just for Equals.
Equals should be slower.

//000004: Dim myDate As Date
//000005: If myDate.Equals(D ate.MinValue) Then
IL_0001: ldloca.s myDate
IL_0003: ldsfld valuetype [mscorlib]System.DateTime
[mscorlib]System.DateTime ::MinValue
IL_0008: box [mscorlib]System.DateTime
IL_000d: call instance bool
[mscorlib]System.DateTime ::Equals(object )
IL_0012: brfalse.s IL_0014
//000006:
//000007: End If
IL_0014: nop
//000008: If myDate = Date.MinValue Then
IL_0015: ldloc.0
IL_0016: ldsfld valuetype [mscorlib]System.DateTime
[mscorlib]System.DateTime ::MinValue
IL_001b: call int32
[mscorlib]System.DateTime ::Compare(value type [mscorlib]System.DateTime ,

valuetype [mscorlib]System.DateTime )
IL_0020: ldc.i4.0
IL_0021: bne.un.s IL_0023
//000009:
//000010: End If

Natty Gur, CTO
Dao2Com Ltd.
34th Elkalay st. Raanana
Israel , 43000
Phone Numbers:
Office: +972-(0)9-7740261
Fax: +972-(0)9-7740261
Mobile: +972-(0)58-888377
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
581
by: Andreas Klemt | last post by:
Hello, I have this Dim myDate As Date ... ... How can I check if this date is empty (value #12.00.00 AM# is in there) ? Thanks,
3
1008
by: Andreas Klemt | last post by:
Hello, what is the difference and what is better (performance etc) ? a) If myDate.Equals(Date.MinValue) b) If myDate = Date.MinValue Thanks, Andreas
8
3254
by: JIM.H. | last post by:
Hello, I am calling a stored procedure to update my table. If one of the date on the screen left empty, I need to send date as null. Since MyDate=”” gives error in asp.net, how should I do this? Thanks, Jim.
1
1596
by: RK | last post by:
What is the difference in performance if using XmlDocument or XmlElement as parameter in C# class method. thanks in advance. --RK
5
1322
MitchR
by: MitchR | last post by:
Hello to All; I have inherited a database and need to have the database post a date in a comments column which I can do. Problem is every time I execute the event procedure it replaces the old date with the new date. I am trying to figure out how to keep the old date and place the new date as well. Here is my code below: Dim myDate As Variant myDate = Date !! = "Date of Notification From Mitch " & myDate & "; " The above code places my...
0
1024
by: =?Utf-8?B?cm9kY2hhcg==?= | last post by:
hey all, is there any difference between right clicking on my web page and saying view in browser or doing a Debug/Start Without Debug ? As far as stuff like cache, Needing to use Rebuild Page for changes I make, etc. thanks, rodchar
3
1134
madhoriya22
by: madhoriya22 | last post by:
HI, I am using this query to get the count from table select count(*) from defect_detail where status = 'RESOLVED' OR 'CLOSED' OR 'VERIFIED' It is retruning count 15. And when I am using this query select count(*) from defect_detail where status in ( 'RESOLVED' , 'CLOSED' , 'VERIFIED') Then it is returnin count as 19. Which one is the correct?
18
8945
by: saykenari | last post by:
Hello Friends I have a problem date format written as DD/MM/YYYY. Date already save into a file as binary. I don't know which technique should be used. Sample date as following a. 31/09/2009 in binary in the file written as 4f 75 25 00 b. 31/05/2008 in binary in the file written as 5a 74 25 00 My problem is how the date would be written as above in binary. Also, how encode or decode.
0
8432
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, well explore What is ONU, What Is Router, ONU & Routers main usage, and What is the difference between ONU and Router. Lets take a closer look ! Part I. Meaning of...
0
8343
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
8545
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8633
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7365
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing, and deploymentwithout human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6185
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupr who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4179
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2762
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1992
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.