다음을 통해 공유


TimeSpan.MaxValue 필드

최대 TimeSpan 값을 나타냅니다. 이 필드는 읽기 전용입니다.

네임스페이스: System
어셈블리: mscorlib(mscorlib.dll)

구문

‘선언
Public Shared ReadOnly MaxValue As TimeSpan
‘사용 방법
Dim value As TimeSpan

value = TimeSpan.MaxValue
public static readonly TimeSpan MaxValue
public:
static initonly TimeSpan MaxValue
public static final TimeSpan MaxValue
public static final var MaxValue : TimeSpan

설명

이 필드의 값은 Int64.MaxValue 틱과 같습니다. 이 값의 문자열 표현은 양수 10675199.02:48:05.4775808입니다.

예제

다음 코드 예제에서는 MaxValue 필드의 값을 참조하여 표시합니다.

' Example of the TimeSpan fields.
Imports System
Imports Microsoft.VisualBasic

Module TimeSpanFieldsDemo
    
    ' Pad the end of a TimeSpan string with spaces if it does not 
    ' contain milliseconds.
    Function Align( interval As TimeSpan ) As String

        Dim intervalStr As String = interval.ToString( )
        Dim pointIndex  As Integer = intervalStr.IndexOf( ":"c )

        pointIndex = intervalStr.IndexOf( "."c, pointIndex )
        If pointIndex < 0 Then intervalStr &= "        "
        Align = intervalStr
    End Function
    
    Sub Main( )

        Const numberFmt As String = "{0,-22}{1,18:N0}"
        Const timeFmt As String = "{0,-22}{1,26}"

        Console.WriteLine( _
            "This example of the fields of the TimeSpan class" & _
            vbCrLf & "generates the following output." & vbCrLf )
        Console.WriteLine( numberFmt, "Field", "Value" )
        Console.WriteLine( numberFmt, "-----", "-----" )

        ' Display the maximum, minimum, and zero TimeSpan values.
        Console.WriteLine( timeFmt, "Maximum TimeSpan", _
            Align( TimeSpan.MaxValue ) )
        Console.WriteLine( timeFmt, "Minimum TimeSpan", _
            Align( TimeSpan.MinValue ) )
        Console.WriteLine( timeFmt, "Zero TimeSpan", _
            Align( TimeSpan.Zero ) )
        Console.WriteLine( )

        ' Display the ticks-per-time-unit fields.
        Console.WriteLine( numberFmt, "Ticks per day", _
            TimeSpan.TicksPerDay )
        Console.WriteLine( numberFmt, "Ticks per hour", _
            TimeSpan.TicksPerHour )
        Console.WriteLine( numberFmt, "Ticks per minute", _
            TimeSpan.TicksPerMinute )
        Console.WriteLine( numberFmt, "Ticks per second", _
            TimeSpan.TicksPerSecond )
        Console.WriteLine( numberFmt, "Ticks per millisecond", _
            TimeSpan.TicksPerMillisecond )
    End Sub 
End Module 

' This example of the fields of the TimeSpan class
' generates the following output.
' 
' Field                              Value
' -----                              -----
' Maximum TimeSpan       10675199.02:48:05.4775807
' Minimum TimeSpan      -10675199.02:48:05.4775808
' Zero TimeSpan                   00:00:00
' 
' Ticks per day            864,000,000,000
' Ticks per hour            36,000,000,000
' Ticks per minute             600,000,000
' Ticks per second              10,000,000
' Ticks per millisecond             10,000
// Example of the TimeSpan fields.
using System;

class TimeSpanFieldsDemo
{
    // Pad the end of a TimeSpan string with spaces if it does not 
    // contain milliseconds.
    static string Align( TimeSpan interval )
    {
        string  intervalStr = interval.ToString( );
        int     pointIndex = intervalStr.IndexOf( ':' );

        pointIndex = intervalStr.IndexOf( '.', pointIndex );
        if( pointIndex < 0 ) intervalStr += "        ";
        return intervalStr;
    } 

    static void Main( )
    {
        const string numberFmt = "{0,-22}{1,18:N0}" ;
        const string timeFmt = "{0,-22}{1,26}" ;

        Console.WriteLine( 
            "This example of the fields of the TimeSpan class" +
            "\ngenerates the following output.\n" );
        Console.WriteLine( numberFmt, "Field", "Value" );
        Console.WriteLine( numberFmt, "-----", "-----" );

        // Display the maximum, minimum, and zero TimeSpan values.
        Console.WriteLine( timeFmt, "Maximum TimeSpan", 
            Align( TimeSpan.MaxValue ) );
        Console.WriteLine( timeFmt, "Minimum TimeSpan", 
            Align( TimeSpan.MinValue ) );
        Console.WriteLine( timeFmt, "Zero TimeSpan", 
            Align( TimeSpan.Zero ) );
        Console.WriteLine( );

        // Display the ticks-per-time-unit fields.
        Console.WriteLine( numberFmt, "Ticks per day", 
            TimeSpan.TicksPerDay );
        Console.WriteLine( numberFmt, "Ticks per hour", 
            TimeSpan.TicksPerHour );
        Console.WriteLine( numberFmt, "Ticks per minute", 
            TimeSpan.TicksPerMinute );
        Console.WriteLine( numberFmt, "Ticks per second", 
            TimeSpan.TicksPerSecond );
        Console.WriteLine( numberFmt, "Ticks per millisecond", 
            TimeSpan.TicksPerMillisecond );
    }
} 

/*
This example of the fields of the TimeSpan class
generates the following output.

Field                              Value
-----                              -----
Maximum TimeSpan       10675199.02:48:05.4775807
Minimum TimeSpan      -10675199.02:48:05.4775808
Zero TimeSpan                   00:00:00

Ticks per day            864,000,000,000
Ticks per hour            36,000,000,000
Ticks per minute             600,000,000
Ticks per second              10,000,000
Ticks per millisecond             10,000
*/
// Example of the TimeSpan fields.
using namespace System;

// Pad the end of a TimeSpan string with spaces if it does not 
// contain milliseconds.
String^ Align( TimeSpan interval )
{
   String^ intervalStr = interval.ToString();
   int pointIndex = intervalStr->IndexOf( ':' );
   pointIndex = intervalStr->IndexOf( '.', pointIndex );
   if ( pointIndex < 0 )
      intervalStr = String::Concat( intervalStr, "        " );

   return intervalStr;
}

int main()
{
   String^ numberFmt = "{0,-22}{1,18:N0}";
   String^ timeFmt = "{0,-22}{1,26}";
   Console::WriteLine( "This example of the fields of the TimeSpan class"
   "\ngenerates the following output.\n" );
   Console::WriteLine( numberFmt, "Field", "Value" );
   Console::WriteLine( numberFmt, "-----", "-----" );
   
   // Display the maximum, minimum, and zero TimeSpan values.
   Console::WriteLine( timeFmt, "Maximum TimeSpan", Align( TimeSpan::MaxValue ) );
   Console::WriteLine( timeFmt, "Minimum TimeSpan", Align( TimeSpan::MinValue ) );
   Console::WriteLine( timeFmt, "Zero TimeSpan", Align( TimeSpan::Zero ) );
   Console::WriteLine();
   
   // Display the ticks-per-time-unit fields.
   Console::WriteLine( numberFmt, "Ticks per day", TimeSpan::TicksPerDay );
   Console::WriteLine( numberFmt, "Ticks per hour", TimeSpan::TicksPerHour );
   Console::WriteLine( numberFmt, "Ticks per minute", TimeSpan::TicksPerMinute );
   Console::WriteLine( numberFmt, "Ticks per second", TimeSpan::TicksPerSecond );
   Console::WriteLine( numberFmt, "Ticks per millisecond", TimeSpan::TicksPerMillisecond );
}

/*
This example of the fields of the TimeSpan class
generates the following output.

Field                              Value
-----                              -----
Maximum TimeSpan       10675199.02:48:05.4775807
Minimum TimeSpan      -10675199.02:48:05.4775808
Zero TimeSpan                   00:00:00

Ticks per day            864,000,000,000
Ticks per hour            36,000,000,000
Ticks per minute             600,000,000
Ticks per second              10,000,000
Ticks per millisecond             10,000
*/
// Example of the TimeSpan fields.
import System.*;

class TimeSpanFieldsDemo
{
    // Pad the end of a TimeSpan string with spaces if it does not 
    // contain milliseconds.
    static String Align(TimeSpan interval)
    {
        String intervalStr = interval.ToString();
        int pointIndex = intervalStr.IndexOf(':');

        pointIndex = intervalStr.IndexOf('.', pointIndex);
        if (pointIndex < 0) {
            intervalStr += "        ";
        }
        return intervalStr;
    } //Align

    public static void main(String[] args)
    {
        final String numberFmt = "{0,-22}{1,18}";
        final String timeFmt = "{0,-22}{1,26}";

        Console.WriteLine(("This example of the fields of the TimeSpan class" 
            + "\ngenerates the following output.\n"));
        Console.WriteLine(numberFmt, "Field", "Value");
        Console.WriteLine(numberFmt, "-----", "-----");

        // Display the maximum, minimum, and zero TimeSpan values.
        Console.WriteLine(timeFmt, "Maximum TimeSpan", 
            Align(TimeSpan.MaxValue));
        Console.WriteLine(timeFmt, "Minimum TimeSpan",
            Align(TimeSpan.MinValue));
        Console.WriteLine(timeFmt, "Zero TimeSpan", Align(TimeSpan.Zero));
        Console.WriteLine();

        // Display the ticks-per-time-unit fields.
        Console.WriteLine(numberFmt, "Ticks per day", 
            ((System.Int64)TimeSpan.TicksPerDay).ToString("N0"));
        Console.WriteLine(numberFmt, "Ticks per hour", 
            ((System.Int64)TimeSpan.TicksPerHour).ToString("N0"));
        Console.WriteLine(numberFmt, "Ticks per minute", 
            ((System.Int64)TimeSpan.TicksPerMinute).ToString("N0"));
        Console.WriteLine(numberFmt, "Ticks per second", 
            ((System.Int64)TimeSpan.TicksPerSecond).ToString("N0"));
        Console.WriteLine(numberFmt, "Ticks per millisecond", 
            ((System.Int64)TimeSpan.TicksPerMillisecond).ToString("N0"));
    } //main
} //TimeSpanFieldsDemo

/*
This example of the fields of the TimeSpan class
generates the following output.

Field                              Value
-----                              -----
Maximum TimeSpan       10675199.02:48:05.4775807
Minimum TimeSpan      -10675199.02:48:05.4775808
Zero TimeSpan                   00:00:00

Ticks per day            864,000,000,000
Ticks per hour            36,000,000,000
Ticks per minute             600,000,000
Ticks per second              10,000,000
Ticks per millisecond             10,000
*/

플랫폼

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

.NET Framework에서 모든 플래폼의 모든 버전을 지원하지는 않습니다. 지원되는 버전의 목록은 시스템 요구 사항을 참조하십시오.

버전 정보

.NET Framework

2.0, 1.1, 1.0에서 지원

.NET Compact Framework

2.0, 1.0에서 지원

참고 항목

참조

TimeSpan 구조체
TimeSpan 멤버
System 네임스페이스
Int64 구조체
MinValue