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

Syntax

[MonoTouch.Foundation.Export("conformsToProtocol:")]
[MonoTouch.Foundation.Preserve]
public virtual bool ConformsToProtocol (IntPtr protocol)

Parameters

protocol
Pointer to a protocol.

Returns

Must return true if the class implements the protocol.

Remarks

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

Requirements

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