By using representation to load and manage assemblies, you are unable to use code properties simillar to the C# += operator or the aesthetic standard AddHandler assertion to hook-up competition. This procedures reveal suggestions hook-up a pre-existing technique to a celebration through getting the required sorts through reflection, and ways to develop a dynamic system using expression give off and connect it up to a celebration.
For another option to attach an event-handling delegate, see the signal instance for all the AddEventHandler technique the EventInfo class.
To hook-up a delegate using expression
Weight a meeting which has a type that raises competition. Assemblies are usually filled with the set-up.Load system. To keep this case painless, a derived kind in today’s system is utilized, so the GetExecutingAssembly technique is used to weight the present day assembly.
Come a kind subject standing for the sort, and develop a case associated with the means. The CreateInstance(Type) strategy is used in the below signal because the kind have a parameterless constructor. There are specific different overloads regarding the CreateInstance strategy green dating site useful in the event that sort you are creating doesn’t have a parameterless constructor. This new circumstances was stored as kinds thing in order to maintain the literary composition that absolutely nothing is known regarding the installation. (representation enables you to have the kinds in an assembly with no knowledge of his or her name beforehand.)