Simplifying the question, I have these 2 functions
private void ReadFilesCommon(List<string> input)
{
foreach (string entry in input)
{
new Class1(entry, entry.length);
}
}
and
private void ReadFilesCommon2(List<string> input)
{
foreach (string entry in input)
{
new Class2(entry);
}
}
Is it possible to generalize these functions?
My main problem is the different inputs, but putting that aside, is it possible with interfaces?
Something like
private void ReadFilesCommon2(IClass Class)
{
foreach ()
{
new Class(input1);
}
}
foreachloop do with theclassobjects it instatiates? How much of the code is repated vs unique/depedant on the class it is working with (i.e.Class1vsClass2)?inputsprovided, where do they come from? Your question is still too vague.