Creates an immutable object




    C# recipes

    The ImmutableObject class has a private readonly string _name field. A public Name property is defined which takes a function that will be called when the object is set. This function will set the _name field to the object's current name.

    Shortcut: immutable

    public class ImmutableObject
      private readonly string _name;
      public  Name => 
      public ( name)
         = ;
    Codiga Logo
    Codiga Hub
    • Rulesets
    • Playground
    • Snippets
    • Cookbooks
    • Security
    • Privacy Policy
    • Code Privacy
    • Terms of Service
    soc-2 icon

    We are SOC-2 Compliance Certified

    G2 high performer medal

    Codiga – All rights reserved 2022.