Class NSObject
- Namespace
- CarinaStudio.MacOS.ObjectiveC
- Assembly
- CarinaStudio.AppBase.MacOS.dll
Object of Objective-C.
public class NSObject : IDisposable, IEquatable<NSObject>
- Inheritance
-
NSObject
- Implements
- Derived
- Inherited Members
- Extension Methods
Constructors
NSObject(Class, IntPtr, bool)
Initialize new NSObject instance.
protected NSObject(Class cls, IntPtr handle, bool ownsInstance)
Parameters
clsClassClass of instance.
handlenintHandle of instance.
ownsInstanceboolTrue to own the instance.
NSObject(IntPtr, bool)
Initialize new NSObject instance.
protected NSObject(IntPtr handle, bool ownsInstance)
Parameters
Properties
Class
Get class of instance.
public Class Class { get; }
Property Value
Handle
Get handle of instance.
public IntPtr Handle { get; }
Property Value
IsDefaultInstance
Check whether the instance is default instance which cannot be disposed.
public bool IsDefaultInstance { get; protected set; }
Property Value
IsReleased
Check whether instance has been released or not.
public bool IsReleased { get; }
Property Value
Methods
Equals(NSObject?)
Indicates whether the current object is equal to another object of the same type.
public bool Equals(NSObject? obj)
Parameters
objNSObject
Returns
Equals(object?)
Determines whether the specified object is equal to the current object.
public override bool Equals(object? obj)
Parameters
objobjectThe object to compare with the current object.
Returns
~NSObject()
Finalizer.
protected ~NSObject()
FromHandle(IntPtr, bool)
Wrap given handle as NSObject.
public static NSObject? FromHandle(IntPtr handle, bool ownsInstance = false)
Parameters
Returns
FromHandle(Type, IntPtr, bool)
Wrap given handle as given type.
public static NSObject? FromHandle(Type type, IntPtr handle, bool ownsInstance = false)
Parameters
typeTypeType to wrap the instance.
handlenintHandle of instance.
ownsInstanceboolTrue to owns instance.
Returns
FromHandle<T>(IntPtr, bool)
Wrap given handle as given type.
public static T? FromHandle<T>(IntPtr handle, bool ownsInstance = false) where T : NSObject
Parameters
Returns
- T
Wrapped instance, or Null if
handleis Zero.
Type Parameters
TType to wrap the instance.
GetBooleanProperty(Property)
Get value of property as bool.
public bool GetBooleanProperty(Property property)
Parameters
propertyPropertyProperty.
Returns
- bool
Value.
GetDoubleProperty(Property)
Get value of property as double.
public double GetDoubleProperty(Property property)
Parameters
propertyPropertyProperty.
Returns
- double
Value.
GetHashCode()
Serves as the default hash function.
public override int GetHashCode()
Returns
- int
A hash code for the current object.
GetInt32Property(Property)
Get value of property as int.
public int GetInt32Property(Property property)
Parameters
propertyPropertyProperty.
Returns
- int
Value.
GetIntPtrProperty(Property)
Get value of property as nint.
public nint GetIntPtrProperty(Property property)
Parameters
propertyPropertyProperty.
Returns
- nint
Value.
GetNSObjectProperty<T>(Property)
Get value of property as NSObject.
public T? GetNSObjectProperty<T>(Property property) where T : NSObject
Parameters
propertyPropertyProperty.
Returns
- T
Value.
Type Parameters
T
GetProperty<T>(Property)
Get value of property as given type.
public T GetProperty<T>(Property property)
Parameters
propertyPropertyProperty.
Returns
- T
Value.
Type Parameters
T
GetSingleProperty(Property)
Get value of property as float.
public float GetSingleProperty(Property property)
Parameters
propertyPropertyProperty.
Returns
- float
Value.
GetUInt32Property(Property)
Get value of property as uint.
public uint GetUInt32Property(Property property)
Parameters
propertyPropertyProperty.
Returns
- uint
Value.
GetVariable(IntPtr, Variable, Type)
Get instance variable as given type.
public static object? GetVariable(IntPtr obj, Variable ivar, Type targetType)
Parameters
objnintHandle of instance.
ivarVariableDescriptor of instance variable.
targetTypeTypeType of value of instance variable.
Returns
- object
Value of variable.
GetVariable<T>(Variable)
Get instance variable as given type.
public T GetVariable<T>(Variable ivar)
Parameters
ivarVariableDescriptor of instance variable.
Returns
- T
Value of variable.
Type Parameters
TType of variable.
GetVariable<T>(IntPtr, Variable)
Get instance variable as given type.
public static T GetVariable<T>(IntPtr obj, Variable ivar)
Parameters
Returns
- T
Value of variable.
Type Parameters
TType of variable.
Initialize(IntPtr)
Call default initializer (init) without parameter.
public static IntPtr Initialize(IntPtr obj)
Parameters
objnintHandle of uninitialized instance.
Returns
- nint
Handle of initialized instance.
OnRelease()
Called to release instance.
protected virtual void OnRelease()
Release()
Release the instance.
public void Release()
Release(IntPtr)
Release the instance.
public static void Release(IntPtr obj)
Parameters
objnintHandle of instance.
Retain(Type, IntPtr)
Retain the instance.
public static NSObject? Retain(Type type, IntPtr handle)
Parameters
Returns
Retain<T>()
Retain the instance.
public T Retain<T>() where T : NSObject
Returns
- T
Retained instance.
Type Parameters
TType of instance.
Retain<T>(IntPtr)
Retain the instance.
public static T? Retain<T>(IntPtr handle) where T : NSObject
Parameters
handlenintHandle of instance to retain.
Returns
- T
Retained instance, or Null if
handleis Zero.
Type Parameters
TType of instance.
SendMessage(Selector)
Send message to instance.
public void SendMessage(Selector selector)
Parameters
selectorSelectorSelector.
SendMessage(Selector, object?)
Send message to instance.
public void SendMessage(Selector selector, object? arg)
Parameters
SendMessage(Selector, params object?[])
Send message to instance.
public void SendMessage(Selector selector, params object?[] args)
Parameters
SendMessage(IntPtr, Selector)
Send message to instance.
public static void SendMessage(IntPtr obj, Selector selector)
Parameters
SendMessage(IntPtr, Selector, object?)
Send message to instance.
public static void SendMessage(IntPtr obj, Selector selector, object? arg)
Parameters
SendMessage(IntPtr, Selector, params object?[])
Send message to instance.
public static void SendMessage(IntPtr obj, Selector selector, params object?[] args)
Parameters
SendMessageToSuper(Selector)
Send message to super class of instance.
public void SendMessageToSuper(Selector selector)
Parameters
selectorSelectorSelector.
SendMessageToSuper(Selector, object?)
Send message to super class of instance.
public void SendMessageToSuper(Selector selector, object? arg)
Parameters
SendMessageToSuper(Selector, params object?[])
Send message to super class of instance.
public void SendMessageToSuper(Selector selector, params object?[] args)
Parameters
SendMessageToSuper(IntPtr, Selector)
Send message to super class of instance.
public static void SendMessageToSuper(IntPtr obj, Selector selector)
Parameters
SendMessageToSuper(IntPtr, Selector, object?)
Send message to super class of instance.
public static void SendMessageToSuper(IntPtr obj, Selector selector, object? arg)
Parameters
SendMessageToSuper(IntPtr, Selector, params object?[])
Send message to super class of instance.
public static void SendMessageToSuper(IntPtr obj, Selector selector, params object?[] args)
Parameters
SendMessageToSuper<T>(Selector)
Send message to super class of instance.
public T SendMessageToSuper<T>(Selector selector)
Parameters
selectorSelectorSelector.
Returns
- T
Result.
Type Parameters
TType of returned value.
SendMessageToSuper<T>(Selector, params object?[])
Send message to super class of instance.
public T SendMessageToSuper<T>(Selector selector, params object?[] args)
Parameters
Returns
- T
Result.
Type Parameters
TType of returned value.
SendMessageToSuper<T>(IntPtr, Selector)
Send message to super class of instance.
public static T SendMessageToSuper<T>(IntPtr obj, Selector selector)
Parameters
Returns
- T
Result.
Type Parameters
TType of returned value.
SendMessageToSuper<T>(IntPtr, Selector, params object?[])
Send message to super class of instance.
public static T SendMessageToSuper<T>(IntPtr obj, Selector selector, params object?[] args)
Parameters
Returns
- T
Result.
Type Parameters
TType of returned value.
SendMessage<T>(Selector)
Send message to instance.
public T SendMessage<T>(Selector selector)
Parameters
selectorSelectorSelector.
Returns
- T
Result.
Type Parameters
TType of returned value.
SendMessage<T>(Selector, params object?[])
Send message to instance.
public T SendMessage<T>(Selector selector, params object?[] args)
Parameters
Returns
- T
Result.
Type Parameters
TType of returned value.
SendMessage<T>(IntPtr, Selector)
Send message to instance.
public static T SendMessage<T>(IntPtr obj, Selector selector)
Parameters
Returns
- T
Result.
Type Parameters
TType of returned value.
SendMessage<T>(IntPtr, Selector, params object?[])
Send message to instance.
public static T SendMessage<T>(IntPtr obj, Selector selector, params object?[] args)
Parameters
Returns
- T
Result.
Type Parameters
TType of returned value.
SetProperty(Property, NSObject?)
Set value of property.
public void SetProperty(Property property, NSObject? value)
Parameters
SetProperty(Property, bool)
Set value of property.
public void SetProperty(Property property, bool value)
Parameters
SetProperty(Property, double)
Set value of property.
public void SetProperty(Property property, double value)
Parameters
SetProperty(Property, int)
Set value of property.
public void SetProperty(Property property, int value)
Parameters
SetProperty(Property, nint)
Set value of property.
public void SetProperty(Property property, nint value)
Parameters
SetProperty(Property, float)
Set value of property.
public void SetProperty(Property property, float value)
Parameters
SetProperty(Property, uint)
Set value of property.
public void SetProperty(Property property, uint value)
Parameters
SetProperty<T>(Property, T?)
Set value of property.
public void SetProperty<T>(Property property, T? value)
Parameters
propertyPropertyProperty.
valueTValue.
Type Parameters
TType of property.
SetVariable(Variable, object?)
Set instance variable.
public void SetVariable(Variable ivar, object? value)
Parameters
SetVariable(IntPtr, Variable, object?)
Set instance variable.
public static void SetVariable(IntPtr obj, Variable ivar, object? value)
Parameters
ToString()
Returns a string that represents the current object.
public override string ToString()
Returns
- string
A string that represents the current object.
VerifyClass(Class)
Throw ArgumentException if the class of this instance is not assignable to given class.
protected void VerifyClass(Class cls)
Parameters
clsClassGiven class.
VerifyReleased()
Throw ObjectDisposedException if instance has been released.
protected void VerifyReleased()
Operators
operator ==(NSObject?, NSObject?)
Equality operator.
public static bool operator ==(NSObject? l, NSObject? r)
Parameters
Returns
operator !=(NSObject?, NSObject?)
Inequality operator.
public static bool operator !=(NSObject? l, NSObject? r)