How to calculate the difference between two dates in days in C#?
Hi everyone! I'm a beginner C# developer and I've encountered a problem when working with dates. I need to calculate how many days have passed between two dates. For example, I want to know how many days are left until New Year or how many days have passed since my birthday.\n\nI tried subtracting dates directly, but I get some strange object instead of a number. Here's my code:\n\n```csharp\nDateTime startDate = new DateTime(2023, 1, 1);\nDateTime endDate = new DateTime(2023, 12, 31);\nvar result = endDate - startDate;\nConsole.WriteLine(result); // Outputs "364.00:00:00"\n```\n\nI expected to see just the number 364, but there's some format with hours and minutes. How do I correctly get the number of full days? Do I need to use any special methods or properties? I would be grateful for a detailed explanation.