Share via


NSFileHandle.Notifications.ObserveReadToEndOfFileCompletion Method

Definition

Overloads

ObserveReadToEndOfFileCompletion(EventHandler<NSFileHandleReadEventArgs>)

Strongly typed notification for the ReadToEndOfFileCompletionNotification constant.

public static Foundation.NSObject ObserveReadToEndOfFileCompletion(EventHandler<Foundation.NSFileHandleReadEventArgs> handler);
static member ObserveReadToEndOfFileCompletion : EventHandler<Foundation.NSFileHandleReadEventArgs> -> Foundation.NSObject

Parameters

handler
EventHandler<NSFileHandleReadEventArgs>

The handler that responds to the notification when it occurs.

Returns

Token object that can be used to stop receiving notifications by either disposing it or passing it to RemoveObservers(IEnumerable<NSObject>).

Remarks

This method can be used to subscribe to ReadToEndOfFileCompletionNotification notifications.

// Listen to all notifications posted for any object
var token = NSFileHandle.Notifications.ObserveReadToEndOfFileCompletion ((notification) => {
  Console.WriteLine ("Observed ReadToEndOfFileCompletionNotification!");
};

// Stop listening for notifications
token.Dispose ();

Applies to

ObserveReadToEndOfFileCompletion(NSObject, EventHandler<NSFileHandleReadEventArgs>)

Strongly typed notification for the ReadToEndOfFileCompletionNotification constant.

public static Foundation.NSObject ObserveReadToEndOfFileCompletion(Foundation.NSObject objectToObserve, EventHandler<Foundation.NSFileHandleReadEventArgs> handler);
static member ObserveReadToEndOfFileCompletion : Foundation.NSObject * EventHandler<Foundation.NSFileHandleReadEventArgs> -> Foundation.NSObject

Parameters

objectToObserve
NSObject

The specific object to observe.

handler
EventHandler<NSFileHandleReadEventArgs>

The handler that responds to the notification when it occurs.

Returns

Token object that can be used to stop receiving notifications by either disposing it or passing it to RemoveObservers(IEnumerable<NSObject>).

Remarks

This method can be used to subscribe to ReadToEndOfFileCompletionNotification notifications.

// Listen to all notifications posted for a single object
var token = NSFileHandle.Notifications.ObserveReadToEndOfFileCompletion (objectToObserve, (notification) => {
  Console.WriteLine ($"Observed ReadToEndOfFileCompletionNotification for {nameof (objectToObserve)}!");
};

// Stop listening for notifications
token.Dispose ();

Applies to