Is there a way to check if a variable is value type of reference type?
Imagine:
private object GetSomething<T>(params T[] values)
{
foreach (var value in values)
{
bool is ValueType; // Check if 'value' is a value type or reference type
}
}
Job done… it doesn’t matter if any of the values is
null, and it works even for an empty array.