Come accedere a un metodo protetto in C#
-
28-10-2019 - |
Domanda
Vorrei sapere come accedere a un metodo protetto.
Ho un controllo del browser Web (Awesomium) che ha molti metodi protetti.
Ho creato un browser a schede con questo WebControl in una Winform.
Ora non posso usare IE InjectKeyboard
-Method Cause è protetto.
Questo è il metodo:
// Injects a keyboard event.
//
// Parameter:
// keyEvent:
// The keyboard event to inject. You'll need to initialize the members of the
// passed Awesomium.Core.WebKeyboardEvent, yourself.
//
// Note:
// Awesomium.Windows.Forms.WebControl handles this internally. Inheritors do
// not need to call this method unless they implement custom logic. This method
// bypasses settings of the Awesomium.Windows.Forms.WebControl.InputController.
// For performance reasons, no validity check is performed when calling protected
// members. Inheritors should perform any such checks (see Awesomium.Windows.Forms.WebControl.IsLive),
// before calling these members.
protected void InjectKeyboardEvent(WebKeyboardEvent keyEvent);
Mentre nel collegamento API è QUI
Perché hanno protetto questo metodo e come posso usarlo?
Soluzione
Ereditare da questa classe ed esporre il metodo se è necessario (come proposto dal commento sopra il metodo).
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow