TypeDescriptor is used to bag information of a Type. To use it, you need to pass a necessary to its static methods. In the above code, I have sam created an object of Button class you can use any class for this and got the information name in this example from it. The GetProperties actually take either ses object or Typeof object to list all the Events it has in a form of PropertyDescriptorCollection.
Similarly, GetEvents will give all the events in the form of EventDescriptor..
I hope you could use the code later while building your library. TypeDescriptor is a static sealed jings which makes the starting point of the API. It exposes information of the object in terms of Properties, Attributes, Events, etc. Even though the basic usage of TypeDescriptor is to get metadata of an object, esx it also exposes features to extend the object on the fly. Let us now discuss few capabilities of Descriptors with a little information about its usage.