Class CFObject
- Namespace
- CarinaStudio.MacOS.CoreFoundation
- Assembly
- CarinaStudio.AppBase.MacOS.dll
Object of Core Foundation.
public class CFObject : IShareableDisposable<CFObject>, IDisposable
- Inheritance
-
CFObject
- Implements
- Derived
- Inherited Members
- Extension Methods
Constructors
CFObject(IntPtr, bool)
Initialize new CFObject instance.
protected CFObject(IntPtr handle, bool ownsInstance)
Parameters
CFObject(IntPtr, uint, bool)
Initialize new CFObject instance.
protected CFObject(IntPtr handle, uint typeId, bool ownsInstance)
Parameters
handlenintHandle of instance.
typeIduintType ID.
ownsInstanceboolTrue to get ownership of instance.
Properties
Handle
Get native handle of instance.
public IntPtr Handle { get; }
Property Value
IsDefaultInstance
Check whether the instance is default instance which cannot be released or not.
public bool IsDefaultInstance { get; protected set; }
Property Value
IsReleased
Check whether instance has been released or not.
public bool IsReleased { get; }
Property Value
TypeDescription
Get description of type.
public string TypeDescription { get; }
Property Value
TypeId
Get type ID.
public uint TypeId { get; }
Property Value
Methods
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
~CFObject()
Finalizer.
protected ~CFObject()
FromHandle(IntPtr, bool)
Wrap a native object.
public static CFObject FromHandle(IntPtr cf, bool ownsInstance = false)
Parameters
Returns
- CFObject
Wrapped object.
FromHandle(Type, IntPtr, bool)
Wrap a native object.
public static CFObject FromHandle(Type type, IntPtr cf, bool ownsInstance = false)
Parameters
typeTypeTarget type.
cfnintHandle of instance.
ownsInstanceboolTrue to owns the native object.
Returns
- CFObject
Wrapped object.
FromHandle<T>(IntPtr, bool)
Wrap a native object.
public static T FromHandle<T>(IntPtr cf, bool ownsInstance = false) where T : CFObject
Parameters
Returns
- T
Wrapped object.
Type Parameters
TTarget type.
GetHashCode()
Serves as the default hash function.
public override int GetHashCode()
Returns
- int
A hash code for the current object.
OnRelease()
Called when releasing instance.
public virtual void OnRelease()
Release()
Release the instance.
public void Release()
Release(IntPtr)
Release given instance.
public static void Release(IntPtr cf)
Parameters
cfnintHandle of instance.
Retain()
Retain the object.
public virtual CFObject Retain()
Returns
- CFObject
New instance of retained object.
Retain(IntPtr)
Retain given instance.
public static IntPtr Retain(IntPtr cf)
Parameters
cfnintHandle of instance.
Returns
- nint
Handle of retained instance.
Retain<T>()
Retain the object with specific type.
public T Retain<T>() where T : CFObject
Returns
- T
New instance of retained object.
Type Parameters
TSpecific type.
ToString()
Returns a string that represents the current object.
public override string? ToString()
Returns
- string
A string that represents the current object.
VerifyReleased()
Throw ObjectDisposedException if instance has been released.
protected void VerifyReleased()
Operators
operator ==(CFObject?, CFObject?)
Equality operator.
public static bool operator ==(CFObject? l, CFObject? r)
Parameters
Returns
operator !=(CFObject?, CFObject?)
Inequality operator.
public static bool operator !=(CFObject? l, CFObject? r)