In WPF projects Resharper offers to remove inheritance from Window
class as redundant:
using System.Windows;
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
}
It is become possible to remove even using System.Windows;
.
public partial class MainWindow
{
public MainWindow()
{
InitializeComponent();
}
}
Why actually he offer this and why without that inheritance everything works fine? As I read in books of WPF any window anyway should be inherited...
XAML code-behind files are partial classes. The code generated by the compiler from the XAML file also includes the Window derivation so the one in the code-behind is redundant.
Your MainWindow
class (like most designer-generated classes) is a partial
class. This means that the implementation for your class can be broken up into multiple files, as long as they're all within the same assembly.
Because the designer-generated file for MainWindow
also contains : Window
, it's not necessary to include it in any other files.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With