Created
March 1, 2013 19:18
-
-
Save tugberkugurlu/5067026 to your computer and use it in GitHub Desktop.
IsAssignableFrom
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Program { | |
static void Main(string[] args) { | |
var type = typeof(Foo); | |
var isIFoo = typeof(IFoo).IsAssignableFrom(type); | |
} | |
} | |
public interface IFoo { | |
void Do(); | |
} | |
public class Foo : IFoo { | |
public void Do() { | |
Console.WriteLine("Done!"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment