-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathIPropertyGetInterceptor.cs
21 lines (20 loc) · 1.07 KB
/
IPropertyGetInterceptor.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
using System;
using System.Reflection;
namespace Someta
{
/// <summary>
/// Have your extension point implement this interface to be able to intercept property get invocations.
/// You can call the original implementation of the get method via the provided getter delegate.
/// </summary>
public interface IPropertyGetInterceptor : IExtensionPoint
{
/// <summary>
/// Called each time a the getter for the property this interceptor is attached to is accessed.
/// </summary>
/// <param name="propertyInfo">The PropertyInfo that this extension was applied to.</param>
/// <param name="instance">For static properties, this is null. For instance properties, this is the instance containing the property.</param>
/// <param name="getter">A delegate you can invoke to call the original getter.</param>
/// <returns>The value of the property that should be returned to the caller.</returns>
object GetPropertyValue(PropertyInfo propertyInfo, object instance, Func<object> getter);
}
}