Window mainWindow = new Window(); Type windowType = mainWindow.GetType(); Console.WriteLine(windowType.FullName);
public void GetWindowTypeIn this example, we define a generic method called `GetWindowType` that takes a type parameter `T`, which must be a derived class of the `Window` class. In the method, we use the `Activator.CreateInstance() where T : Window { T window = Activator.CreateInstance (); Type windowType = window.GetType(); Console.WriteLine(windowType.FullName); }