Friendica
Khalid-a-tron ⚡
Khalid-a-tron ⚡

Khalid-a-tron ⚡

khalidabuhakmeh@mastodon.social

Khalid-a-tron ⚡

khalidabuhakmeh@mastodon.social

Loves @NicoleAbuhakmeh. #OSS supporter. #software developer. He/Him. Living the simulation lifestyle. #dotnet #java #javascript #html

searchable

ActivityPub
2022-12-08 14:46:39 2022-12-08 14:46:38 2022-12-08 14:44:03 1653142

Khalid-a-tron ⚡
Khalid-a-tron ⚡
mastodon - Link to source

Khalid-a-tron ⚡

3 years ago • •

Khalid-a-tron ⚡

3 years ago • •


The new "required" keyword in #csharp 11 and #dotnet 7 are pretty cool.

Force consumers of your object to define values for properties. This helps reduce the need for constructor overloads.

public class Previous
    {
        public string Name { get; }

        public Previous(string name)
        {
            Name = name;
        }
    }

    public class Updated
    {
        public required string Name { get; set; }
    }
#dotnet #csharp
  •  Languages
  •  Search Text
  •  Share via ...
in reply to Khalid-a-tron ⚡

Arkadiusz Świętnicki 🇨🇳 I HAVE MOVED
mastodon - Link to source

Arkadiusz Świętnicki 🇨🇳 I HAVE MOVED

in reply to Khalid-a-tron ⚡ • 3 years ago • •
FInally! I wish we got something like convenience inits in Swift, where we can make an optional constructor without much hassle.
  •  Languages
  •  Search Text
  •  Share via ...
⇧