Problem: reference the private class and private method of third-party class libraries
The essence of this problem is to modify the metadata of the. net assembly and change the private modifier of the corresponding classes and methods to public.
Assume the following assembly is available:
CancelSealedClassLib. dll has the following types of definitions:
Using System;
Using System. Collections. Generic;
Using System. Linq;
Using System. Text;
Namespace CancelSealedClassLib
{
Class mySealedClass
{
Private void DisplayInfo ()
{
Console. WriteLine ("Hello {0}", this. GetType (). Name );
}
}
}
CFF Explorer. This tool allows you to view and modify the metadata of the. net assembly.
1. Open CancelSealedClassLib. dll
2. Click the red area to bring up the following window:
3. select public. The access level of mySealedClass has been changed to public.
4. Select the following Red Area
5. select public and change mySealedClass. DisplayInfo () to public.
6. Click Save to save the metadata modification.