C# unlike Java don't allows to define classes inside an interface. What is the correct place for defining classes that are used only in interface functions?
Currently I'm using the following architecture
namespace MyNameSpace
{
public class MyReturnType
{
// Contents
}
public class MyArgsType
{
// Contents
}
public interface ICalibrationCheckController
{
MyReturnType PerformCalibrationCheck(MyArgsType arg);
}
}
But this architecture requires a separate namespaces for each interface definition. Otherwise if I'll define in the same namespace the other interface there will be difficult to separate what classes are used by the first interface and what by the other interface.
Ideally I'd like to define necessary classes inside interface definition but it is not allowed.
namespace MyNameSpace
{
public interface ICalibrationCheckController
{
public class MyReturnType
{
// Contents
}
public class MyArgsType
{
// Contents
}
MyReturnType PerformCalibrationCheck(MyArgsType arg);
}
}
What approach are you using and what is correct?