TimeSpan in C#

TimeSpan is a one of structure. It has constructor with overloading. There are many properties are in TimeSpan. Initialize a new instance of the TimeSpan structure to a specified number of hours, minutes and seconds. Contructors, Properties, Methods, Fields, Operators are important in TimeSpan.

Contructors

TimeSpan(Int32, Int32, Int32)
public TimeSpan(int hours,int minutes,int seconds)

TimeSpan(Int32, Int32, Int32, Int32)
public TimeSpan(int days,int hours,int minutes,int seconds)

TimeSpan(Int32, Int32, Int32, Int32, Int32)
public TimeSpan(int days,int hours,int minutes,int seconds,int milliseconds)

TimeSpan(Int64)
public TimeSpan(long ticks)

Properties

  • Days
  • Hours
  • Milliseconds
  • Minutes
  • Second

Methods

  • Add(TimeSpan)
  • Compare(TimeSpan, TimeSpan)
  • CompareTo(Object)
  • CompareTo(TimeSpan)

Fields

There are many fields are MaxValue, MinValue, TicksPerDay, TicksPerHour, TicksPerMinute and TicksPerSecond. System is a namespace to TimeSpan. If you remove System namespace it will be shows following error message "The type or namespace name 'TimeSpan' could not be found (are you missing a using directive or an assembly reference?)".

Ebook Download
View all
Learn
View all