I'm used to seeing old code like
if (true)
{
...
}
where it is intuitively clear that someone was lazy or too careful when making changes. Today I came across this snippet, and I'm curious if there is a functional difference between making such a comparison as follows:
private static bool logField(Type t, string fieldname)
{
if (t.ToString() == typeof (Property).ToString())
{
...
}
return true;
}
and do it like this:
private static bool logField(Type t, string fieldname)
{
if (t == typeof (Property))
{
...
}
return true;
}
source
share