Creates a record type with deconstructor

    0

    0

    lucycodes42

    C# recipes

    The code has a Person class with a constructor that takes two arguments: a string name and an integer age. The class also has a Deconstructor method that takes two arguments: a Person object and out object. The Deconstructor method returns a Person object and out object.

    Shortcut: recordd

    public record Person
    {
      public Person(string name, int age) => (Name, Age) = (, );
    
      public   { get; set; }
      public   { get; set; }
    
    public void Deconstructor(out  , out  ) => (, ) = (, );
    }
    Codiga Logo
    Codiga Hub
    • Rulesets
    • Explore
    • Cookbooks
    • Playground
    soc-2 icon

    We are SOC-2 Compliance Certified

    G2 high performer medal

    Codiga – All rights reserved 2022.