Created
January 29, 2014 17:24
-
-
Save sharwell/8692708 to your computer and use it in GitHub Desktop.
Infinite loop, or clean wrapper?
This file contains 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
static class Helper | |
{ | |
public static T WrapCall<T>(Func<T> func) | |
{ | |
Console.WriteLine("Calling function"); | |
return func(); | |
} | |
} | |
class Foo | |
{ | |
protected virtual int MethodImpl() | |
{ | |
return 3; | |
} | |
} | |
class WrappedFoo : Foo | |
{ | |
protected override int MethodImpl() | |
{ | |
return Helper.WrapCall(base.MethodImpl); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment