C# TimeSpan Ticks

Description

TimeSpan Ticks gets the number of ticks that represent the value of the current TimeSpan structure.

Syntax

TimeSpan.Ticks has the following syntax.


public long Ticks { get; }

Example

The following example creates several TimeSpan objects and displays the Seconds property of each.


using System;//from ww  w  .j  a va 2 s . c o m

class TimeSpanPropertiesDemo
{
    static void Main( )
    {
        TimeSpan ts = new TimeSpan( 98712345678 );
        Console.WriteLine(ts.Ticks);
    } 
}

The code above generates the following result.





















Home »
  C# Tutorial »
    System »




Array
BitConverter
Boolean
Byte
Char
Console
ConsoleKeyInfo
Convert
DateTime
DateTimeOffset
Decimal
Double
Enum
Environment
Exception
Guid
Int16
Int32
Int64
Math
OperatingSystem
Random
SByte
Single
String
StringComparer
TimeSpan
TimeZone
TimeZoneInfo
Tuple
Tuple
Tuple
Type
UInt16
UInt32
UInt64
Uri
Version