Multiple types in a params without casting?
Feel like I'm hoping for an unrealistic expectation, but is it possible to have multiple types in a params without casting to avoid GC?
eg...
3 Replies
you can use generics:
That wouldn't allow for multiple types
Unless you use object, you can't have an array of multiple types
You could make a kind of wrapper type which represents one type or another, but there is no built-in way to do this.
okay thanks. I'll probably just eat the cast cost. its not really super performant crucial and shouldn't hurt anything in the long run.