views:

41

answers:

1

Is there any real difference between:

id value;
BOOL compare1 = [value isMemberOfClass:[SomeClass class]];
BOOL compare2 = [value class] == [SomeClass class];

to check if value is a SomeClass object?

+4  A: 

If value is an NSProxy, isMemberOfClass: will properly check the proxied object, the other construct, I believe, won't (I think it will clumsily duplicate isProxy:).

Alex Martelli
Yup -- you are correct (I forgot about NSProxy). Deleted my answer. Use `isMemberOfClass:` as it is correct always whereas `==` has holes.
bbum