secret
Created

Implicit inheritance example (C#)

  • Download Gist
gistfile1.cs
C#
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
void Main()
{
var b = new B();
Console.WriteLine(String.Format("B is A: {0}", (b is A)));
Console.WriteLine(String.Format("B is ISoftDelete: {0}", (b is ISoftDelete)));
}
 
interface ISoftDelete
{
bool IsDeleted {get; set;}
}
 
class A {
public int Id {get; set;}
}
 
partial class B : A {
public bool IsDeleted {get; set;}
}
 
partial class B : ISoftDelete {}

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.