I want to pass a type parameter to my *.xaml.cs file. The C# code will look like this:
public partial class Filter<T> : Window where T : IFilterableType
{
private readonly IEnumerable<T> _rows;
public Filter(IEnumerable<T> rows)
{
this._rows = rows;
}
}
Since this is a partial class, and since Visual Studio generates the other part of the class, I am concerned that my type parameter <T>
will get deleted when Visual Studio regenerates the other part of the partial class. So far in my testing, this hasn't happened, but I want to be sure.
Can I pass a type argument to a *.xaml.cs file like this?
If not, is there any other way for my *.xaml.cs class to have a private List of some generic type? I would try something like what's below, but that of course doesn't compile.
public partial class Filter : Window
{
private IEnumerable<T> _rows;
public Filter() { }
public void LoadList(IEnumerable<T> rows) where T : IFilterableType
{
this._rows = rows;
}
}