MonoTouch.Foundation.NSObject.ConformsToProtocol Method
Invoked to determine if this object implements the specified protocol.


public virtual bool ConformsToProtocol (IntPtr protocol)


Pointer to a protocol.


Must return true if the class implements the protocol.


You can override this method if you need your class to respond to Objective-C's query to the object as to whether it implements the specified protocol.

You can compare the IntPtr value with the result of creating an AdoptsAttribute with the specified protocol and fetching its ProtocolHandle.

c# Example

static AdoptsAttribute myProtocol = new AdoptsAttribute ("MyProtocol");
public override ConformsToProtocol (IntPtr protocol)
	if (protocol == myProtocol.ProtocolHandle)
		return true;
	return false;

Although typically you would merely decorare your class with the MonoTouch.ObjCRuntime.AdoptsAttribute and let the runtime do this for you, like this:

c# Example

[Adopts ("UITextInput")]
[Register ("MyCoreView")]
public class EditableCoreTextView : UIView {
	[Export ("inputDelegate")]
	public UITextInputDelegate InputDelegate {...}

For a complete sample of the AdoptsAttribute see the SimpleTextInput sample


Namespace: MonoTouch.Foundation
Assembly: monotouch (in monotouch.dll)
Assembly Versions: