S
semedao
Hi , I have this method to check something..
my question is if changing the order of the "if " will make it faster
when the "val" argument is 99% or int or string
for example , the IsSerializable is faster or slower then
val is string , or val is int...
?
here is the code:
bool method(Object val)
{
Type _type = val.GetType();
if (_type.IsPrimitive)
return true;
else if (_type.IsEnum)
return true;
else if (_type.IsSerializable)
return true;
else if (val is string)
return true;
else if (val is string[])
return true;
else if (val is byte[])
return true;
else
return false;
}
my question is if changing the order of the "if " will make it faster
when the "val" argument is 99% or int or string
for example , the IsSerializable is faster or slower then
val is string , or val is int...
?
here is the code:
bool method(Object val)
{
Type _type = val.GetType();
if (_type.IsPrimitive)
return true;
else if (_type.IsEnum)
return true;
else if (_type.IsSerializable)
return true;
else if (val is string)
return true;
else if (val is string[])
return true;
else if (val is byte[])
return true;
else
return false;
}
