TimeSpan.MinValue Alan
Tanım
Önemli
Bazı bilgiler ürünün ön sürümüyle ilgilidir ve sürüm öncesinde önemli değişiklikler yapılmış olabilir. Burada verilen bilgilerle ilgili olarak Microsoft açık veya zımni hiçbir garanti vermez.
En düşük TimeSpan değeri temsil eder. Bu alan salt okunur durumdadır.
public: static initonly TimeSpan MinValue;
public static readonly TimeSpan MinValue;
staticval mutable MinValue : TimeSpan
Public Shared ReadOnly MinValue As TimeSpan
Alan Değeri
Örnekler
Aşağıdaki örnek, alanın değerine MinValue başvurur ve değerini görüntüler.
// 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.
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.
open System
// Pad the end of a TimeSpan string with spaces if it does not
// contain milliseconds.
let align (interval: TimeSpan) =
let intervalStr = string interval
let pointIndex = intervalStr.IndexOf ':'
let pointIndex = intervalStr.IndexOf('.', pointIndex)
if pointIndex < 0 then intervalStr + " "
else intervalStr
printfn "This example of the fields of the TimeSpan class\ngenerates the following output.\n"
printfn "%-22s%18s" "Field" "Value"
printfn "%-22s%18s" "-----" "-----"
// Display the maximum, minimum, and zero TimeSpan values.
printfn $"""{"Maximum TimeSpan",-22}{align TimeSpan.MaxValue,26}"""
printfn $"""{"Minimum TimeSpan",-22}{align TimeSpan.MinValue,26}"""
printfn $"""{"Zero TimeSpan",-22}{align TimeSpan.Zero,26}
"""
// Display the ticks-per-time-unit fields.
printfn $"""{"Ticks per day",-22}{TimeSpan.TicksPerDay,18:N0}"""
printfn $"""{"Ticks per hour",-22}{TimeSpan.TicksPerHour,18:N0}"""
printfn $"""{"Ticks per minute",-22}{TimeSpan.TicksPerMinute,18:N0}"""
printfn $"""{"Ticks per second",-22}{TimeSpan.TicksPerSecond,18:N0}"""
printfn $"""{"Ticks per millisecond",-22}{TimeSpan.TicksPerMillisecond,18:N0}"""
(*
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.
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
Açıklamalar
Bu alanın değeri, değer işaretleriyle Int64.MinValue eşdeğerdir. Bu değerin dize gösterimi negatif 10675199.02:48:05.4775808 veya negatif 10.675.199 günden biraz daha fazladır.
Şunlara uygulanır
Ayrıca bkz.
GitHub'da bizimle işbirliği yapın
Bu içeriğin kaynağı GitHub'da bulunabilir; burada ayrıca sorunları ve çekme isteklerini oluşturup gözden geçirebilirsiniz. Daha fazla bilgi için katkıda bulunan kılavuzumuzu inceleyin.