Home »
.Net »
C# Programs
C# - TimeSpan.Ticks Property with Example
In this tutorial, we will learn about the C# TimeSpan.Ticks property with its definition, usage, syntax, and example.
By Nidhi Last updated : March 30, 2023
TimeSpan.Ticks Property
The TimeSpan.Ticks property is read-only which is used to represent Ticks of the current instance in TimeSpan structure.
Syntax
int TimeSpan.Ticks;
Parameter(s)
Return Value
This property returns an integer value that represents the number of ticks in the current instance of the TimeSpan structure.
C# Example of TimeSpan.Ticks Property
The source code to demonstrate the use of Ticks property of TimeSpan structure is given below. The given program is compiled and executed successfully.
using System;
class TimeSpanDemo {
//Entry point of Program
static public void Main() {
TimeSpan timeSpan = new TimeSpan(10000000);
Console.WriteLine("Total ticks:" + timeSpan.Ticks);
}
}
Output
Total ticks:10000000
Press any key to continue . . .
C# TimeSpan Programs »