TimeSpan Seconds() is part of time, whereas TimeSpan TotalSeconds() converts entire time to seconds.
Let us first see the TimeSpan Seconds() method.
Example
using System;
using System.Linq;
public class Demo {
public static void Main() {
TimeSpan ts = new TimeSpan(0, 100, 0, 20, 0);
// seconds
Console.WriteLine(ts.Seconds);
}
}Output
20
Now, let us see how TotalSeconds works for the same TimeSpan value.
Example
using System;
using System.Linq;
public class Demo {
public static void Main() {
TimeSpan ts = new TimeSpan(0, 100, 0, 20, 0);
// total seconds
Console.WriteLine(ts.TotalSeconds);
}
}Output
360020
Now, we will see both of them in the same example.
Example
using System;
using System.Linq;
public class Demo {
public static void Main() {
TimeSpan ts = new TimeSpan(0, 100, 0, 20, 0);
// seconds
Console.WriteLine(ts.Seconds);
// total seconds
Console.WriteLine(ts.TotalSeconds);
}
}Output
20 360020