2
Greetings.
I have a method that receives 3 paramentrics: collection, business, quantity
Collection: is a class Collection who inherits another class, ex: man, woman, old...
Business: is a class that contains the methods that make the negotiations before accessing the database (programming in 3 layers).
Amount: is only an integer type value.
Now imagine that my collection could be: homemCollection, womenColection, elderlyCollection or childrenCollection.
Imagine my business class could be: homeNegos, Womens, ElderlyGoodies, children...
What I want is for my method to receive any of these values and so I will use it for any of these classes.
I researched generic methods, generic classes, Linq, but I couldn’t solve the problem.
Follows the code of the Method:
private void MeuMetodo(HomemCollection colecao, HomemNegocios negocios, int quantidade)
{
string retorno = negocios.nomeDoMetodoDaCamadaNegocios(colecao, negocios, quantidade)
}
This above method can only receive the collection and the business of man, I want to let this method receiving any other class.
If anyone has any link or material for me to study this situation, I am very grateful.
The classes
Collection
andNegocios
, they inherit from a unique type, or implement someinterface
?– Marco Giovanni