WHAT is struct used for c# code example
Example 1: structure in c sharp with example
struct Coordinate
{
public int x { get; set; }
public int y { get; set; }
public void SetOrigin()
{
this.x = 0;
this.y = 0;
}
}
Coordinate point = Coordinate();
point.SetOrigin();
Console.WriteLine(point.x); //output: 0
Console.WriteLine(point.y); //output: 0
Example 2: structure in c sharp with example
struct Coordinate
{
public int x;
public int y;
}