Skip to content

Instantly share code, notes, and snippets.

@rogeralsing
Last active August 29, 2015 14:05
Show Gist options
  • Save rogeralsing/965c3ba740f0c43bd90e to your computer and use it in GitHub Desktop.
Save rogeralsing/965c3ba740f0c43bd90e to your computer and use it in GitHub Desktop.
public class Foo<T> where T: IDoStuff
{
private T _stuffer;
public Foo(T stuffer)
{
_stuffer = stuffer;
}
public void Bar()
{
//will this be a direct call or resolved through interface lookup?
_stuffer.StuffTheStuff();
}
}
@rogeralsing
Copy link
Author

Awesome answer!
Too bad I couldn't hack my way past virtual lookup though.

@mgravell
Copy link

Well you can: use structs :)

But really, I don't think that is going to be an important part of any performance issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment