I would like to do something like the below
public interface IFormatter<TData, TFormat>
{
TFormat Format(TData data);
}
public abstract class BaseFormatter<TData> : IFormatter<TData, XElement>
{
public abstract XElement Format(TData data);
}
However, when I do the above I get an error about “The type or method has 2 generic parameters but only 1 was provided …”. I’ll try and tackle it another way but I’m curious as to why this cannot be done?
Note that while this compiles in a single assembly, I have since noticed that the error message is actually generated by an assembly that is using this piece of code (a test assembly). This is where the error message noted above is generated.
Just in case anyone has this issue:
It turns out that the problem was related to the private field accessor in a MSTest unit testing project in the same solution. When I removed the accessor the project compiled.