private void Application_Startup(object sender, StartupEventArgs e) { // Get the startup URI string startupUri = e.Args[0]; // Do something with the URI }
private void Application_Startup(object sender, StartupEventArgs e) { // Handle command-line arguments if (e.Args.Length > 0) { // Do something with the argument(s) } }In this example, we handle any command-line arguments that were passed to the application during startup. We check the length of the Args property in the StartupEventArgs object to see if any arguments were passed, and then use them in our application. Overall, the System.Windows.StartupEventArgs class is useful for retrieving information about the startup of a WPF application and handling any command-line arguments that were passed to it.