A similar problem is discussed here
http://stackoverflow.com/questions/6557/in-c-why-cant-a-liststring-object-be-stored-in-a-listobject-variable[
^]
To convert List<string> to List<object>, each element of List<string> is to be cast to object type as below
List<string> Obj1 = new List<string>();
Obj1.Add(strLoginName);
Obj1.Add(strpassword);
Obj1.Add(strdomain);
List<object> Obj1AsObjects = Obj1.Cast<object>().ToList();
string scondition = "";
GenericFun(scondition, Obj1AsObjects);
But then in
GenericFun
what operation can be done on the
parameters
. Because, Object type has only the basic methods, which may not be much useful to perform some practical calculations or other manipulations. Hence, it is preferable create a heirarchy using classes and interfaces and then pass the parameter type as the base class of this heirarchy.