Creates a time span object, representing a given number of hours. - CSharp System

CSharp examples for System:TimeSpan

Description

Creates a time span object, representing a given number of hours.

Demo Code


using System.Globalization;
using System;//from w  w w  . j av a2  s . c om

public class Main{
        /// <summary>
    ///   <para>Creates a time span object, representing a given number of hours.</para>
    /// </summary>
    /// <param name="self">Number of hours.</param>
    /// <returns>Time span instance.</returns>
    public static TimeSpan Hours(this int self)
    {
      return new TimeSpan(self, 0, 0);
    }
        /// <summary>
    ///   <para>Creates a time span object, representing a given number of hours.</para>
    /// </summary>
    /// <param name="self">Number of hours.</param>
    /// <returns>Time span instance.</returns>
    public static TimeSpan Hours(this short self)
    {
      return new TimeSpan(self, 0, 0);
    }
        /// <summary>
    ///   <para>Creates a time span object, representing a given number of hours.</para>
    /// </summary>
    /// <param name="self">Number of hours.</param>
    /// <returns>Time span instance.</returns>
    public static TimeSpan Hours(this byte self)
    {
      return new TimeSpan(self, 0, 0);
    }
}

Related Tutorials