C# - TimeSpan.Zero Property with Example

In this tutorial, we will learn about the C# TimeSpan.Zero property with its definition, usage, syntax, and example. By Nidhi Last updated : March 29, 2023

TimeSpan.Zero Property

The TimeSpan.Zero property is read-only which is used to represent Zero TimeSpan.

Syntax

TimeSpan TimeSpan.Zero;

Parameter(s)

  • None

Return Value

This property returns zero TimeSpan.

C# Example of TimeSpan.Zero Property

The source code to demonstrate the use of Zero property of TimeSpan structure is given below. The given program is compiled and executed successfully.

using System;

class TimeSpanDemo {
  //Entry point of Program
  static public void Main() {
    TimeSpan zero;

    zero = TimeSpan.Zero;

    Console.WriteLine("Zero Time Span: " + zero);
  }
}

Output

Zero Time Span: 00:00:00
Press any key to continue . . .

C# TimeSpan Programs »





Comments and Discussions!

Load comments ↻





Copyright © 2024 www.includehelp.com. All rights reserved.