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

CSharp examples for System:DateTime Day

Description

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

Demo Code


using System.Globalization;
using System;/*from   www.  ja v a  2  s . c  o  m*/

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

Related Tutorials