public string Code { get;set;}
public string Name { get;set;}
public string Description { get;set;}
public int Price { get;set;}
public Product(string Code, string Name, string Description, int Price)
if(String.IsNullOrWhiteSpace(Code))
throw new ArgumentNullException($"{nameof(this.Code)} cannot be empty");
if(String.IsNullOrWhiteSpace(Name))
throw new ArgumentNullException($"{nameof(this.Name)} cannot be empty");
if(String.IsNullOrWhiteSpace(Description))
throw new ArgumentNullException($"{nameof(this.Description)} cannot be empty");
this.Description = Description;
throw new ArgumentNullException($"{nameof(this.Price)} should be greater than 0");
public void DisplayValues()
Console.WriteLine($"{nameof(this.Code)} - {this.Code}");
Console.WriteLine($"{nameof(this.Name)} - {this.Name}");
Console.WriteLine($"{nameof(this.Description)} - {this.Description}");
Console.WriteLine($"{nameof(this.Price)} - {this.Price}");
public static void Main()
Console.WriteLine("With null value");
Product prod1 = new Product(null, null,null,2);
Console.WriteLine(e.Message);
Console.WriteLine("\nWithout null values");
Product prod2 = new Product("640", "Nokia 640 XL","Nokia 640 XL LTE",15000);