Skip to content

Instantly share code, notes, and snippets.

@Kritner
Created June 24, 2021 11:27
Show Gist options
  • Save Kritner/81e3e5a5c038244d10854fca41d7664b to your computer and use it in GitHub Desktop.
Save Kritner/81e3e5a5c038244d10854fca41d7664b to your computer and use it in GitHub Desktop.
Trying out the new "record" type, hoping to get a solution for the xml documentation of properties vs constructor parameters
/// <summary>
/// Represents a blimey!
/// </summary>
/// <param name="Scoot"><inheritdoc cref="Scoot"/></param>
/// <param name="IsNeat"><inheritdoc cref="IsNeat"/></param>
public record Blimey(int Scoot, bool IsNeat)
{
/// <summary>
/// The scoot
/// </summary>
public int Scoot { get; } = Scoot;
/// <summary>
/// Is the Blimey neat?
/// </summary>
public bool IsNeat { get; } = IsNeat;
}
/// <summary>
/// Represents a bloop!
/// </summary>
/// <param name="Scoot">The scoot</param>
/// <param name="IsNeat">Is the bloop neat?</param>
public record Bloop(int Scoot, bool IsNeat)
{
/// <summary>
/// The scoot
/// </summary>
public int Scoot { get; } = Scoot;
/// <summary>
/// Is the bloop neat?
/// </summary>
public bool IsNeat { get; } = IsNeat;
}
/// <summary>
/// Represents a doot!
/// </summary>
/// <param name="Scoot">The scoot</param>
/// <param name="IsNeat">Is the doot neat?</param>
public record Doot(int Scoot, bool IsNeat);
public class Test
{
public void Bar()
{
var doot = new Doot(42, true);
var bloop = new Bloop(42, true);
var blimey = new Blimey(42, true);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment