mirror of
https://github.com/markjprice/cs11dotnet7.git
synced 2025-12-06 05:32:03 +01:00
18 lines
450 B
C#
18 lines
450 B
C#
namespace Packt.Shared;
|
|
|
|
public class ImmutablePerson
|
|
{
|
|
public string? FirstName { get; init; }
|
|
public string? LastName { get; init; }
|
|
}
|
|
|
|
public record ImmutableVehicle
|
|
{
|
|
public int Wheels { get; init; }
|
|
public string? Color { get; init; }
|
|
public string? Brand { get; init; }
|
|
}
|
|
|
|
// simpler way to define a record
|
|
// auto-generates the properties, constructor, and deconstructor
|
|
public record ImmutableAnimal(string Name, string Species); |