Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@EdCharbeneau
Created October 3, 2013 15:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save EdCharbeneau/6812190 to your computer and use it in GitHub Desktop.
Save EdCharbeneau/6812190 to your computer and use it in GitHub Desktop.
@MLaritz: anyone know if there's a way to find in a class that implements an interface, all the public methods that aren't part of the interface? #vs
var targetType = typeof(Target);
targetType.GetMethods()
.Select(m => m.Name)
.Except(targetType.GetInterfaces()
.SelectMany(i => i.GetMethods()
.Select(im => im.Name)))
//---out
//ScoreGame
//ToString
//Equals
//GetHashCode
//GetType
public class Target : ITargetable
{
public void BullsEye()
{
}
public void ScoreGame()
{
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment