It depends:
if (thing.TypeName == NamesEnum.thisthing)
will work faster than GetType() , as this is a simple comparison of two numeric values.
But:
if (thing.GetType() == typeof(thisthing))
more "flexible": when you do some refactoring, change the type name or something else, this condition will work anyway.
But it will fail if 2 types belong to 2 different assemblies, instead, in the first case, it will match as equal, since you are not using types , but simply listing the values.
In short, there is no better approach best suited to your needs.
source share