Create struct with two member fields - CSharp Custom Type

CSharp examples for Custom Type:struct

Description

Create struct with two member fields

Demo Code

using System;// w  ww.  j  av a  2 s .  c o m
using System.Collections.Generic;
using System.Text;
public struct Coordinates
{
   public double Longitude { get; set; }
   public double Latitude { get; set; }
}
class Program
{
   static void Main(string[] args)
   {
      Coordinates c = new Coordinates();
      c.Longitude = 45.67890;
      c.Latitude = 38.79851;
      Console.WriteLine("I am here: ( {0} , {1} )", c.Longitude, c.Latitude);
   }
}

Result


Related Tutorials