Hy,
I have some methods which are identical as functionality but dependent on the parameter received from the method.For example:
public long GetElementsFromList(long el,List<long> lst)
{
Random rndElement = new Random();
int random = rndElement.Next(0, this.lst.Count - 1);
if (random >= this.lst.IndexOf(el)) random += 1;
return this.lst[random];
}
public string GetElements2FromList(string el,List<string> lst)
{
Random rndElement = new Random();
int random = rndElement.Next(0,this.sucursale.Count-1);
if (random >= this.lst.IndexOf(el)) random += 1;
return this.lst[random];
}
I want to have a generic method which is not dependent on the return value and also on the type of parameter.
I'm thinking about generics but i cannot handle myself.
Some advice?Thank you