Answers for "c# struct with constructor"

C#
1

struct constructor c#

struct Coordinate
{
    public int x;
    public int y;

    public Coordinate(int x, int y)
    {
        this.x = x;
        this.y = y;
    }
}
Posted by: Guest on June-18-2021
0

example of constructor in c#

class Program
{
  static void Main(string[] args)
  {
    Car Ford = new Car("Mustang", "Red", 1969);
    Car Opel = new Car("Astra", "White", 2005);

    Console.WriteLine(Ford.model);
    Console.WriteLine(Opel.model);
  }
}
Posted by: Guest on May-06-2021

C# Answers by Framework

Browse Popular Code Answers by Language