Comments on: Compare DateTime in C# https://code-maze.com/csharp-compare-datetime/ Learn. Code. Succeed. Thu, 01 Feb 2024 14:50:33 +0000 hourly 1 https://wordpress.org/?v=6.7.5 By: Marinko Spasojević https://code-maze.com/csharp-compare-datetime/#comment-8190 Fri, 19 May 2023 06:19:20 +0000 https://drafts.code-maze.com/?p=89403#comment-8190 In reply to Henry.

Hi Henry. Well, they are. The Equals method is recommended, and even though for so many examples both will return the same result, they are in construction different. By design, we can use the Equals method to check the equality of a datatime and an object variable, you can’t do that with just ==. To avoid confusion, I’ve also removed that one sentence for the last snippet.

]]>
By: Henry https://code-maze.com/csharp-compare-datetime/#comment-8189 Fri, 19 May 2023 05:22:24 +0000 https://drafts.code-maze.com/?p=89403#comment-8189 I have tried a lot of examples. But I can’t see the difference between Equals() method and the “==” operator as you mentioned. The source codes in GitHub don’t demonstrate clearly about it. I researched and found that they are the same. Are they actually different?

]]>