Home > Net >  Reflection loading problem
Reflection loading problem

Time:10-08

DLL in the presence of a delegate
 
The public event SenderCardMachineEventHandler SenderCardMachineEventFun;
Public delegate void SenderCardMachineEventHandler (int nHotelID, object Obj, E_OPERATION_STATUS Status);

The E_OPERATION_STATUS for DLL in an enumeration

Under normal circumstances we are quoting this DLL and then define a
 
Public void SendCardCallback (int nHotelID, object Obj, E_OPERATION_STATUS Status)
{
//specific operation
}

SenderCardMachineEventFun +=SendCardCallback;

To make calls,

Now need to use reflection form, now can't meet a problem is to define the public void SendCardCallback (int nHotelID, object Obj, E_OPERATION_STATUS Status) this method, because this enumeration E_OPERATION_STATUS does not exist, need how to change to reflect form, please?

CodePudding user response:

You this DLL is the.net compiler? If it is, after the references should use this enumerated type, or use the int type alternatives to try,

CodePudding user response:

The Type T=Assembly. GetType (" E_OPERATION_STATUS ");

CodePudding user response:

What scenarios lead to must use reflection?
Triggers an event, and was registered method is invoked, and don't call
.
If (SenderCardMachineEventFun!=null)
{
.
SenderCardMachineEventFun (int, object, E_OPERATION_STATUS Status);
.
}
.

CodePudding user response:

Use Enum. Parse
  •  Tags:  
  • C#
  • Related