NSObject.FromObject(Object) Method

Definition

Boxes an object into an NSObject.

public static Foundation.NSObject FromObject (object obj);
static member FromObject : obj -> Foundation.NSObject

Parameters

obj
Object

A ECMA CLI object.

Returns

Boxed object or null if the type can not be boxed.

Remarks

This method can box the following types from a core runtime type to an NSObject type by boxing the values.

bool, char, sbyte, byte, short, ushort, int, int32, long, long64, float and double are boxed as NSNumbers.

IntPtr are boxed as NSValue containing a pointer.

System.Drawing.SizeF, System.Drawing.RectangleF, System.Drawing.PointF, MonoTouch.CoreGraphics.CGAffineTransform, MonoTouch.UIKit.UIEdgeInsets and MonoTouch.CoreAnimation.CATransform3D are boxed as an NSValue containing the corresponding type.

NSObjects and subclasses are returned as-is.

The null value is returned as an NSNull.

Applies to