Created
December 23, 2020 14:35
-
-
Save crgrieve/3df50a35ebf3b140ea5ffd0d4c6a35d3 to your computer and use it in GitHub Desktop.
C# 9 init properties, error example.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
var glasgowMeetup = new Meetup() { | |
City ="Glasgow", | |
Topic = ".Net" | |
}; | |
glasgowMeetup.Topic = "Umbraco"; | |
glasgowMeetup.City = "Edinburgh"; | |
Console.WriteLine(glasgowMeetup); | |
public record Meetup | |
{ | |
public string City { get; init; } | |
public string Topic { get; set; } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment