Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication1
{
public struct Customer
{
private int _id;
private string _name;
public int Id
{
get { return _id; }
set { _id = value; }
}
public string Name
{
get { return _name; }
set { _name = value; }
}
public Customer(int Id, string Name)
{
this._id = Id;
this._name = Name;
}
public void PrintDetails()
{
Console.WriteLine("Id = {0} && Name = {1}", this._id, this._name);
}
}
class Program
{
static void Main(string[] args)
{
Customer C1 = new Customer(101, "Tesla");
C1.PrintDetails();
Customer C2 = new Customer();
C2.Id = 102;
C2.Name = "Michael";
C2.PrintDetails();
Customer C3 = new Customer
{
Id = 103,
Name = "Timi"
};
C3.PrintDetails();
Console.ReadKey();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment