I see that this question has been answered for Java, JavaScript, and PHP, but not C#. So, how might one calculate the number of days between two dates in C#?

# C# – Calculate difference between two dates (number of days)

c++date

###### Related Question

- C# – What are the correct version numbers for C#
- C# – Case insensitive ‘Contains(string)’
- Javascript – Compare two dates with JavaScript
- Javascript – How to get the number of days between two dates in JavaScript
- Javascript – find documentation on formatting a date in JavaScript
- C# – Difference in months between two dates
- Java – Why is subtracting these two times (in 1927) giving a strange result

## Best Solution

Assuming

`StartDate`

and`EndDate`

are of type`DateTime`

: