foo(1, 2, "one", "two", p);
Console.WriteLine();
foo("one", "two", p, 1, 2 );
}
public static void foo(params object[] list)
{
foreach(object o in list)
{
if (o.GetType() == typeof(int))
{
Console.WriteLine(o);
}
else if (o.GetType() == typeof(string))
{
Console.WriteLine(o);
}
else if (o.GetType() == typeof(Program))
{
Console.WriteLine(((Program)o).value);
}
}
}
}
}










