I\'m using reflection to loop through a Type
\'s properties and set certain types to their default. Now, I could do a switch on the type and set the defau
public static object GetDefault(Type type)
{
if(type.IsValueType)
{
return Activator.CreateInstance(type);
}
return null;
}
In the newer version of .net such as .net standard, type.IsValueType
needs to be written as type.GetTypeInfo().IsValueType