Related: A list of multiple data types?
I want to know how to store different array types (including system types) inside an array.
The above question covered ho
You can create a custom collection in which you implement Add() method which only accepts doubles and string, something like:
void Add(object toAdd)
{
if (toAdd is string)
// add into inner collection ...
... (same for double)
}
But, to be honest, I really can't think of any way that you would need a collection that accepts only these two types. You can probably solve the problem some other way...