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

CSharp examples for System:TimeSpan

Description

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

Demo Code


using System.Globalization;
using System;/*ww w  .j  av a 2  s.c om*/

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

Related Tutorials