I have an array of objects where i store different value types inside. One of those types is a stopwatch. How can i handle it? To what should i convert the array ellement to be able to handle it as a stopwatch?
Here is a small reproducer of how my code looks like
public static object[] test()
{
object[] obj = new object[6];
obj[0] = bool;
obj[1] = string;
obj[2] = double;
obj[3] = float;
obj[4] = int;
obj[5] = System.Diagnostics.Stopwatch.StartNew();
return obj;
}
object[] testobject = new object[6];
testobject = test();
Console.WriteLine(testobject[5].Elapsed.TotalMilliseconds); //handle stopwatch