/// <summary> /// Wraps the callback. /// </summary> /// <param name="callback">Callback to wrap</param> /// <returns>Wrapped callback</returns> private static Children2CallbackDelegate WrapCallback(ChildrenCallbackDelegate callback) { if (callback == null) { return(null); } return((int rc, string path, object ctx, IReadOnlyList <string> children, IStat stat) => { callback(rc, path, ctx, children); }); }
/// <summary> /// Initializes a new instance of the <see cref="RequestGetChildren"/> class. /// </summary> /// <param name="path">Path to the node</param> /// <param name="context">Context associated with the request</param> /// <param name="watcher">Optional <see cref="IWatcher"/> to set on the node</param> /// <param name="callback">Callback to invoke when the request is completed</param> /// <param name="retrievalCondition">Retrieval conditions</param> /// <param name="uid">Unique id to assign to the request</param> public RequestGetChildren(string path, object context, IWatcher watcher, ChildrenCallbackDelegate callback, string retrievalCondition = null, ulong uid = 0) : this(path, context, watcher, WrapCallback(callback), retrievalCondition, uid) { }