Skip to content

Commit

Permalink
Merge pull request #353 from Reactive-Extensions/CSharp60DelegateInvo…
Browse files Browse the repository at this point in the history
…cation

Delegate invocation using C# 6.0 syntax
  • Loading branch information
Oren Novotny authored Apr 13, 2017
2 parents 67a8288 + e46f163 commit c4cc5dd
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,7 @@ private void Cancel()
if (w != null)
w.Dispose();

var c = _continuation;
if (c != null)
c();
_continuation?.Invoke();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,7 @@ public bool IsDisposed
/// </summary>
public void Dispose()
{
var dispose = Interlocked.Exchange(ref _dispose, null);
if (dispose != null)
{
dispose();
}
Interlocked.Exchange(ref _dispose, null)?.Invoke();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -62,16 +62,12 @@ public static void Release()

private static void OnSuspending(object sender, HostSuspendingEventArgs e)
{
var suspending = Suspending;
if (suspending != null)
suspending(sender, e);
Suspending?.Invoke(sender, e);
}

private static void OnResuming(object sender, HostResumingEventArgs e)
{
var resuming = Resuming;
if (resuming != null)
resuming(sender, e);
Resuming?.Invoke(sender, e);
}

private static IHostLifecycleNotifications InitializeNotifications()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,7 @@ private void TimeChanged()
var diff = now - (_lastTime + _period);
if (Math.Abs(diff.TotalMilliseconds) >= MAXERROR)
{
var scc = _systemClockChanged;
if (scc != null)
scc(this, new SystemClockChangedEventArgs(_lastTime + _period, now));
_systemClockChanged?.Invoke(this, new SystemClockChangedEventArgs(_lastTime + _period, now));

NewTimer();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,14 @@ public AsyncInfoToObservableBridge(IAsyncInfo info, Action<IAsyncInfo, Action<IA

_subject = new AsyncSubject<TResult>();

if (onProgress != null)
onProgress?.Invoke(info, (iai, p) =>
{
onProgress(info, (iai, p) =>
{
if (multiValue && getResult != null)
_subject.OnNext(getResult(iai));
if (multiValue && getResult != null)
_subject.OnNext(getResult(iai));
if (progress != null)
progress.Report(p);
});
}
if (progress != null)
progress.Report(p);
});

Done(info, info.Status, true);
}
Expand Down

0 comments on commit c4cc5dd

Please sign in to comment.