Skip to content

Instantly share code, notes, and snippets.

@CyrusNajmabadi
Last active March 20, 2020 04:28
Show Gist options
  • Save CyrusNajmabadi/e7224d82782f5c0b6b58f301cdf2be1e to your computer and use it in GitHub Desktop.
Save CyrusNajmabadi/e7224d82782f5c0b6b58f301cdf2be1e to your computer and use it in GitHub Desktop.
public class Person
{
public Person(int age, string name);
public int Age { get; }
public string Name { get; }
public virtual Person With(in Builder builder);
public ref struct Builder
{
public int Age { get; set; }
public string Name { get; set; }
public bool HasAge { get; }
public bool HasName { get; }
}
}
public class Student : Person
{
public Student(int age, string name, double gpa);
public double Gpa { get; }
public override Person With(in Person.Builder builder);
public virtual Student With(in Builder builder);
public ref struct Builder
{
public Person.Builder Parent;
public int Age { get; set; }
public string Name { get; set; }
public double Gpa { get; set; }
public bool HasAge { get; }
public bool HasName { get; }
public bool HasGpa { get; }
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment