![]() |
VOOZH | about |
dotnet add package System.Reflection.DispatchProxy --version 4.8.2
NuGet\Install-Package System.Reflection.DispatchProxy -Version 4.8.2
<PackageReference Include="System.Reflection.DispatchProxy" Version="4.8.2" />
<PackageVersion Include="System.Reflection.DispatchProxy" Version="4.8.2" />Directory.Packages.props
<PackageReference Include="System.Reflection.DispatchProxy" />Project file
paket add System.Reflection.DispatchProxy --version 4.8.2
#r "nuget: System.Reflection.DispatchProxy, 4.8.2"
#:package System.Reflection.DispatchProxy@4.8.2
#addin nuget:?package=System.Reflection.DispatchProxy&version=4.8.2Install as a Cake Addin
#tool nuget:?package=System.Reflection.DispatchProxy&version=4.8.2Install as a Cake Tool
Provides a DispatchProxy class to dynamically create proxy instances that implement a specified interface.
Method invocations on a generated proxy instance are dispatched to a Invoke() method. Having a single invoke method allows centralized handling for scenarios such as logging, error handling and caching.
Create the proxy class that derives from DispatchProxy, override Invoke() and call one of the static DispatchProxy.Create() methods to generate the proxy type.
The example below intercepts calls to the ICallMe interface and logs them.
class Program
{
static void Main(string[] args)
{
ICallMe proxy = LoggingDispatchProxy.Create<ICallMe>(new MyClass());
proxy.CallMe("Hello!");
}
}
public interface ICallMe
{
void CallMe(string name);
}
public class MyClass : ICallMe
{
public void CallMe(string message)
{
Console.WriteLine($"Inside the called method with input '{message}'");
}
}
public class LoggingDispatchProxy : DispatchProxy
{
private ICallMe _target;
protected override object Invoke(MethodInfo targetMethod, object[] args)
{
Console.WriteLine($"Calling method: '{targetMethod.Name}' with arguments: '{string.Join(", ", args)}'");
object result = targetMethod.Invoke(_target, args);
Console.WriteLine($"Called method: '{targetMethod.Name}'.");
return result;
}
public static T Create<T>(T target) where T : class
{
LoggingDispatchProxy proxy = DispatchProxy.Create<T, LoggingDispatchProxy>() as LoggingDispatchProxy;
proxy._target = (ICallMe)target;
return proxy as T;
}
}
The main types provided by this library are:
System.Reflection.DispatchProxy is released as open source under the MIT license.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 net5.0 was computed. net5.0-windows net5.0-windows was computed. net6.0 net6.0 was computed. net6.0-android net6.0-android was computed. net6.0-ios net6.0-ios was computed. net6.0-maccatalyst net6.0-maccatalyst was computed. net6.0-macos net6.0-macos was computed. net6.0-tvos net6.0-tvos was computed. net6.0-windows net6.0-windows was computed. net7.0 net7.0 was computed. net7.0-android net7.0-android was computed. net7.0-ios net7.0-ios was computed. net7.0-maccatalyst net7.0-maccatalyst was computed. net7.0-macos net7.0-macos was computed. net7.0-tvos net7.0-tvos was computed. net7.0-windows net7.0-windows was computed. net8.0 net8.0 was computed. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 was computed. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 was computed. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 netcoreapp2.0 is compatible. netcoreapp2.1 netcoreapp2.1 was computed. netcoreapp2.2 netcoreapp2.2 was computed. netcoreapp3.0 netcoreapp3.0 was computed. netcoreapp3.1 netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 netstandard2.0 is compatible. netstandard2.1 netstandard2.1 is compatible. |
| .NET Framework | net461 net461 was computed. net462 net462 is compatible. net463 net463 was computed. net47 net47 was computed. net471 net471 was computed. net472 net472 was computed. net48 net48 was computed. net481 net481 was computed. |
| MonoAndroid | monoandroid monoandroid was computed. |
| MonoMac | monomac monomac was computed. |
| MonoTouch | monotouch monotouch was computed. |
| Tizen | tizen40 tizen40 was computed. tizen60 tizen60 was computed. |
| Xamarin.iOS | xamarinios xamarinios was computed. |
| Xamarin.Mac | xamarinmac xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos xamarinwatchos was computed. |
Showing the top 5 NuGet packages that depend on System.Reflection.DispatchProxy:
| Package | Downloads |
|---|---|
|
System.Private.ServiceModel
Package Description |
|
|
CoreWCF.Primitives
CoreWCF is a port of the service side of Windows Communication Foundation (WCF) to .NET Core. The goal of this project is to enable existing WCF services to move to .NET Core. |
|
|
CoreWCF.Http
CoreWCF is a port of the service side of Windows Communication Foundation (WCF) to .NET Core. The goal of this project is to enable existing WCF services to move to .NET Core. |
|
|
CoreWCF.NetTcp
CoreWCF is a port of the service side of Windows Communication Foundation (WCF) to .NET Core. The goal of this project is to enable existing WCF services to move to .NET Core. |
|
|
CoreWCF.WebHttp
CoreWCF is a port of the service side of Windows Communication Foundation (WCF) to .NET Core. The goal of this project is to enable existing WCF services to move to .NET Core. |
Showing the top 12 popular GitHub repositories that depend on System.Reflection.DispatchProxy:
| Repository | Stars |
|---|---|
|
CoreWCF/CoreWCF
Main repository for the Core WCF project
|
|
|
dotnet/wcf
This repo contains the client-oriented WCF libraries that enable applications built on .NET Core to communicate with WCF services.
|
|
|
RRQM/TouchSocket
TouchSocket is an integrated .NET networking framework that includes modules for socket, TCP, UDP, SSL, named pipes, HTTP, WebSocket, RPC, and more. It offers a one-stop solution for TCP packet issues and enables quick implementation of custom data message parsing using protocol templates.
|
|
|
malware-dev/MDK-SE
Malware's Development Kit for SE
|
|
|
open-telemetry/opentelemetry-dotnet-contrib
This repository contains set of components extending functionality of the OpenTelemetry .NET SDK. Instrumentation libraries, exporters, and other components can find their home here.
|
|
|
Code-Sharp/WampSharp
A C# implementation of WAMP (The Web Application Messaging Protocol)
|
|
|
DevrexLabs/memstate
In-memory event-sourced ACID-transactional distributed object graph engine for .NET Standard
|
|
|
jacqueskang/IpcServiceFramework
.NET Core Inter-process communication framework
|
|
|
hikalkan/scs
TCP Server/Client Communication and RMI Framework
|
|
|
beetlex-io/BeetleX-Samples
BeetleX micro services framework (tcp webapi websocket and xrpc) samples
|
|
|
zzzprojects/EntityFramework-Classic
Entity Framework Classic is a supported version of the latest EF6 codebase. It supports .NET Framework and .NET Core and overcomes some EF limitations by adding tons of must-haves built-in features.
|
|
|
Ginger-Automation/Ginger
Ginger Automation IDE
|
| Version | Downloads | Last Updated |
|---|---|---|
| 4.8.2 | 1,692,247 | 3/19/2025 |
| 4.8.0 | 470,442 | 11/12/2024 |
| 4.7.1 | 213,107,997 | 5/12/2020 |
| 4.7.0 | 1,305,842 | 12/3/2019 |
| 4.7.0-preview3.19551.4 | 1,179 | 11/13/2019 |
| 4.7.0-preview2.19523.17 | 1,155 | 11/1/2019 |
| 4.7.0-preview1.19504.10 | 1,173 | 10/15/2019 |
| 4.6.0 | 817,791 | 9/23/2019 |
| 4.6.0-rc1.19456.4 | 1,219 | 9/16/2019 |
| 4.6.0-preview9.19421.4 | 1,302 | 9/4/2019 |
| 4.6.0-preview9.19416.11 | 1,128 | 9/4/2019 |
| 4.6.0-preview6.19264.9 | 1,163 | 9/4/2019 |