Skip to content

Instantly share code, notes, and snippets.

@kid
Last active January 22, 2018 15:56
Show Gist options
  • Save kid/eb2e972639c6232fb2110c912e3a44b3 to your computer and use it in GitHub Desktop.
Save kid/eb2e972639c6232fb2110c912e3a44b3 to your computer and use it in GitHub Desktop.
public interface IStringParameter {
public int Id { get; }
public string Key { get; }
}
public abstract class StringParameter : IStringParameter
{
public abstract int Id { get; }
public abstract string Key { get; }
public abstract string Description { get; }
public abstract bool Nullable { get; }
}
public class X : StringParameter {
public int Id { get { return 42; } }
[...]
}
// C# 6 and beyond:
public class Y : StringParameter {
public int Id => 42;
public string Key => "Foobar";
[...]
}
public class Z : StringParameter {
public int Id { get; }
public string Key { get; }
public Z() {
Id = 42;
Key = "Foobar";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment