Create a Simple TimeSpan Struct - CSharp Custom Type

CSharp examples for Custom Type:struct

Description

Create a Simple TimeSpan Struct

Demo Code

using System;//from  w ww .  ja v  a 2 s  .c  o  m
public struct TimeSpan
{
   public uint totalSeconds;
   public TimeSpan(uint initialTotalSeconds)
   {
      totalSeconds = initialTotalSeconds;
   }
}
class Tester
{
   public static void Main()
   {
      TimeSpan myTime;
      myTime.totalSeconds = 8383;
      Console.WriteLine("My time: {0}", myTime.totalSeconds);
   }
}

Result


Related Tutorials