Skip to content

Instantly share code, notes, and snippets.

@yrshaikh
Created August 23, 2020 03:11
Show Gist options
  • Select an option

  • Save yrshaikh/a88c44ddf107abb18ffcce8d3485bc0d to your computer and use it in GitHub Desktop.

Select an option

Save yrshaikh/a88c44ddf107abb18ffcce8d3485bc0d to your computer and use it in GitHub Desktop.

Revisions

  1. yrshaikh renamed this gist Aug 23, 2020. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  2. yrshaikh created this gist Aug 23, 2020.
    12 changes: 12 additions & 0 deletions UsingInitOnlyProperty
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,12 @@
    public class Program
    {
    static void Main(string[] args)
    {
    var employee = new Employee
    {
    Name = "Yasser",
    Department = "IT"
    };
    employee.Name = "Ronaldo"; // compile time error
    }
    }