Skip to content

Instantly share code, notes, and snippets.

@nguerrera
Created March 11, 2016 22:28
Show Gist options
  • Save nguerrera/2bd18614c14993e7e367 to your computer and use it in GitHub Desktop.
Save nguerrera/2bd18614c14993e7e367 to your computer and use it in GitHub Desktop.
Partial property override
class X { }
class Foo {
public virtual X Y { get; set; }
public virtual X Z { get; set; }
}
class Bar : Foo {
public override X Y { set { } }
public override X Z { get { return null; } }
}
class P {
static void Main() {
var b = new Bar();
b.Y = b.Y;
b.Z = b.Z;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment