AccessTools
To simplify reflections, Harmony has a helper class called AccessTools. Here are the most commonly used methods:
Any of these methods use the all BindingFlags definition and thus work on anything regardless if it is public, private, static or else.
Traverse
In order to access fields, properties and methods from classes via reflection, Harmony contains a utility called Traverse. Think of it as LINQ for classes. Here are the main methods:
Example:
Although most fields, properties and methods in that class hierarchy are private, Traverse can easily access anything. It has build-in null protection and propagates null as a result if any of the intermediates would encounter null. It works with static types and caches lookups which makes it pretty fast.
FileLog
For simple and quick logging, Harmony uses a tool class FileLog. It has three methods: