How to list all the properties and methods from the class?

I have a class like this

public class GState2
{
	public static string STATIC_VARIABLE = "Static Variable";
	
	public void PublicFunctionTestMe() {
	}
	private void PrivateFunctionTestMe() {
	}
}

How can I Debug.Log() all the properties and methods? I tried to use reflection which seem to work if I would test classes from the UnityEngine namespace but it doesn’t seem to work for custom classes I create.

This is more a C# question than a Unity question, but the best way to do this is:

To get methods:

Type.GetMethods();

So for example typeof(MyCustomClass).GetMethods(); will return a list of methods in your custom class.

MethodInfo[] method1 = typeof(MyCustomClass).GetMethods(); 

Then on each of these you can use method.ReturnType to get what it returns, and method.Name to get the method name.

To get properties you can simply use Type.GetProperties();

PropertyInfo[] property = typeof(MyCustomClass).GetProperties(); 

And to get the property name you can use property.Name; etc.

Read up on GetProperties() and GetMethods() =)

Sources: