static void Trampoline_StateChangeCallback(IntPtr block, NWConnectionState state, IntPtr error) { var del = BlockLiteral.GetTarget <Action <NWConnectionState, NWError> > (block); if (del != null) { NWError err = error != IntPtr.Zero ? new NWError(error, owns: false) : null; del(state, err); } }
static void TrampolineListenerStateChanged(IntPtr block, NWListenerState state, IntPtr nwerror) { var del = BlockLiteral.GetTarget <Action <NWListenerState, NWError> > (block); if (del != null) { NWError err = nwerror == IntPtr.Zero ? null : new NWError(nwerror, owns: false); del(state, err); err?.Dispose(); } }