Thursday, 25 November 2021

Use C# 9.0 : Record in .Net Framework 4.0 and above

using System;

 

namespace dateCheck

{

 

    public record Person(int id, string name);

    class Program

    {

        static void Main(string[] args)

        {

            var person = new Person(1, "FirstName");

 }

    }

}

 

namespace System.Runtime.CompilerServices

{

    using System.ComponentModel;

    /// <summary>

    /// Reserved to be used by the compiler for tracking metadata.

    /// This class should not be used by developers in source code.

    /// </summary>

    [EditorBrowsable(EditorBrowsableState.Never)]

    internal static class IsExternalInit

    {

    }

} 

No comments:

Post a Comment