iphone - Difference between containsObject: and member: methods of NSSet? -


what diference between these 2 methods belonging nsset class:

-(bool)containsobject:(id)anobject -(id)member:(id)object  

the answer lies in return values. containsobject returns yes or no depending on if object send belongs particular set.

member returns id, means returns actual object if object part of set.

as example, have nsset, aset, anobject. anobject belongs set.

[aset containsobject:anobject]; //returns yes [aset member:anobject]; //if set contains object equal object (as determined isequal:) object (typically object), otherwise nil. 

if anobject not exist in aset:

[aset containsobject:anobject]; //return no [aset member:anobject]; //return nil 

Comments

Popular posts from this blog

c++ - Is it possible to compile a VST on linux? -

java - Output of Eclipse is rubbish -

jquery - Confused with JSON data and normal data in Django ajax request -