Traditionally I would test if a type is a struct
as such:
public void Do<TType>(TType value)
{
if (typeof(TType).IsValueType)
{
// code for structs
}
else
{
// code for non structs
}
}
But now I find the IsValueType
property is not available in the portable class library with the frameworks I'm targeting. How would one go about to check if it is a struct or not then?
I'm targeting:
Try
using System.Reflection;
typeof(TType).GetTypeInfo().IsValueType