Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public override IDisposable Schedule<TState>(TState state, TimeSpan dueTime, Fun
throw new ArgumentNullException(nameof(action));
}

var queue = default(SchedulerQueue<TimeSpan>);
SchedulerQueue<TimeSpan> queue;

// There is no timed task and no task is currently running
if (!_running)
Expand Down
3 changes: 1 addition & 2 deletions Rx.NET/Source/src/System.Reactive/EventSource.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,7 @@ private void Add(Delegate handler, IDisposable disposable)
{
lock (_subscriptions)
{
var l = new Stack<IDisposable>();
if (!_subscriptions.TryGetValue(handler, out l))
if (!_subscriptions.TryGetValue(handler, out var l))
{
_subscriptions[handler] = l = new Stack<IDisposable>();
}
Expand Down
7 changes: 3 additions & 4 deletions Rx.NET/Source/src/System.Reactive/Internal/ExceptionHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,13 @@ public static bool TryAddException(ref Exception field, Exception ex)
return false;
}

var b = default(Exception);
Exception b;

if (current == null)
{
b = ex;
}
else
if (current is AggregateException a)
else if (current is AggregateException a)
{
var list = new List<Exception>(a.InnerExceptions)
{
Expand All @@ -88,6 +87,7 @@ public static bool TryAddException(ref Exception field, Exception ex)
{
b = new AggregateException(current, ex);
}

if (Interlocked.CompareExchange(ref field, b, current) == current)
{
return true;
Expand All @@ -102,7 +102,6 @@ private sealed class TerminatedException : Exception
{
internal TerminatedException() : base("No further exceptions")
{

}
}
}
Expand Down
2 changes: 1 addition & 1 deletion Rx.NET/Source/src/System.Reactive/Internal/Helpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ internal static class Helpers

public static IObservable<T> Unpack<T>(IObservable<T> source)
{
var hasOpt = default(bool);
bool hasOpt;

do
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ public AmbManyEnumerable(IEnumerable<IObservable<T>> sources)
protected override IDisposable Run(IObserver<T> observer)
{
var sourcesEnumerable = _sources;
var sources = default(IObservable<T>[]);

IObservable<T>[] sources;
try
{
sources = sourcesEnumerable.ToArray();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,9 @@ public SingleBase(IObservable<TSource> source, TSource value, bool append)
public IAppendPrepend Append(TSource value)
{
var prev = new Node<TSource>(_value);
var appendNode = default(Node<TSource>);
var prependNode = default(Node<TSource>);

Node<TSource> appendNode;
Node<TSource> prependNode = null;

if (_append)
{
Expand All @@ -54,8 +55,9 @@ public IAppendPrepend Append(TSource value)
public IAppendPrepend Prepend(TSource value)
{
var prev = new Node<TSource>(_value);
var appendNode = default(Node<TSource>);
var prependNode = default(Node<TSource>);

Node<TSource> appendNode = null;
Node<TSource> prependNode;

if (_append)
{
Expand Down
2 changes: 1 addition & 1 deletion Rx.NET/Source/src/System.Reactive/Linq/Observable/Case.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public _(IObserver<TResult> observer)

public void Run(Case<TValue, TResult> parent)
{
var result = default(IObservable<TResult>);
IObservable<TResult> result;
try
{
result = parent.Eval();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public _(Contains<TSource> parent, IObserver<bool> observer)

public override void OnNext(TSource value)
{
var res = false;
bool res;
try
{
res = _comparer.Equals(value, _value);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ private void Initialize()

private void AddHandler(TDelegate onNext)
{
var removeHandler = default(IDisposable);
IDisposable removeHandler;
try
{
removeHandler = _parent.AddHandler(onNext);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public override void OnNext(TSource value)
}

var fireNewMapEntry = false;
var writer = default(Subject<TElement>);
Subject<TElement> writer;
try
{
//
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ public TValue GetOrAdd(TKey key, Func<TValue> valueFactory, out bool added)
{
added = false;

var value = default(TValue);
TValue value;
var newValue = default(TValue);
var hasNewValue = false;
while (true)
Expand Down
2 changes: 1 addition & 1 deletion Rx.NET/Source/src/System.Reactive/Linq/Observable/If.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public _(If<TResult> parent, IObserver<TResult> observer)

public void Run()
{
var result = default(IObservable<TResult>);
IObservable<TResult> result;
try
{
result = _parent.Eval();
Expand Down
6 changes: 2 additions & 4 deletions Rx.NET/Source/src/System.Reactive/Linq/Observable/Max.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,7 @@ public override void OnNext(TSource value)
{
if (_hasValue)
{
var comparison = 0;

int comparison;
try
{
comparison = _comparer.Compare(value, _lastValue);
Expand Down Expand Up @@ -103,8 +102,7 @@ public override void OnNext(TSource value)
}
else
{
var comparison = 0;

int comparison;
try
{
comparison = _comparer.Compare(value, _lastValue);
Expand Down
6 changes: 2 additions & 4 deletions Rx.NET/Source/src/System.Reactive/Linq/Observable/Min.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,7 @@ public override void OnNext(TSource value)
{
if (_hasValue)
{
var comparison = 0;

int comparison;
try
{
comparison = _comparer.Compare(value, _lastValue);
Expand Down Expand Up @@ -108,8 +107,7 @@ public override void OnNext(TSource value)
}
else
{
var comparison = 0;

int comparison;
try
{
comparison = _comparer.Compare(value, _lastValue);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ public override void OnNext(TSource value)
return;
}

var e = default(IEnumerator<TCollection>);
IEnumerator<TCollection> e;
try
{
e = xs.GetEnumerator();
Expand Down Expand Up @@ -470,7 +470,7 @@ public override void OnNext(TSource value)
return;
}

var e = default(IEnumerator<TCollection>);
IEnumerator<TCollection> e;
try
{
e = xs.GetEnumerator();
Expand Down Expand Up @@ -1333,7 +1333,7 @@ public override void OnNext(TSource value)
return;
}

var e = default(IEnumerator<TResult>);
IEnumerator<TResult> e;
try
{
e = xs.GetEnumerator();
Expand Down Expand Up @@ -1416,7 +1416,7 @@ public override void OnNext(TSource value)
return;
}

var e = default(IEnumerator<TResult>);
IEnumerator<TResult> e;
try
{
e = xs.GetEnumerator();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -314,8 +314,7 @@ public override void OnNext(TSource value)

public override void OnCompleted()
{
var hasNext = false;

bool hasNext;
try
{
hasNext = _enumerator.MoveNext();
Expand Down
2 changes: 1 addition & 1 deletion Rx.NET/Source/src/System.Reactive/Linq/Observable/Zip.cs
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ protected override void Dispose(bool disposing)

public override void OnNext(TFirst value)
{
var hasNext = false;
bool hasNext;
try
{
hasNext = _rightEnumerator.MoveNext();
Expand Down
12 changes: 6 additions & 6 deletions Rx.NET/Source/src/System.Reactive/Linq/QueryLanguage.Async.cs
Original file line number Diff line number Diff line change
Expand Up @@ -670,7 +670,7 @@ public virtual IObservable<TSource> StartAsync<TSource>(Func<Task<TSource>> func

private IObservable<TSource> StartAsyncImpl<TSource>(Func<Task<TSource>> functionAsync, IScheduler scheduler)
{
var task = default(Task<TSource>);
Task<TSource> task;
try
{
task = functionAsync();
Expand Down Expand Up @@ -702,7 +702,7 @@ private IObservable<TSource> StartAsyncImpl<TSource>(Func<CancellationToken, Tas
{
var cancellable = new CancellationDisposable();

var task = default(Task<TSource>);
Task<TSource> task;
try
{
task = functionAsync(cancellable.Token);
Expand All @@ -712,7 +712,7 @@ private IObservable<TSource> StartAsyncImpl<TSource>(Func<CancellationToken, Tas
return Throw<TSource>(exception);
}

var result = default(IObservable<TSource>);
IObservable<TSource> result;

if (scheduler != null)
{
Expand Down Expand Up @@ -773,7 +773,7 @@ public virtual IObservable<Unit> StartAsync(Func<Task> actionAsync, IScheduler s

private IObservable<Unit> StartAsyncImpl(Func<Task> actionAsync, IScheduler scheduler)
{
var task = default(Task);
Task task;
try
{
task = actionAsync();
Expand Down Expand Up @@ -805,7 +805,7 @@ private IObservable<Unit> StartAsyncImpl(Func<CancellationToken, Task> actionAsy
{
var cancellable = new CancellationDisposable();

var task = default(Task);
Task task;
try
{
task = actionAsync(cancellable.Token);
Expand All @@ -815,7 +815,7 @@ private IObservable<Unit> StartAsyncImpl(Func<CancellationToken, Task> actionAsy
return Throw<Unit>(exception);
}

var result = default(IObservable<Unit>);
IObservable<Unit> result;

if (scheduler != null)
{
Expand Down
2 changes: 1 addition & 1 deletion Rx.NET/Source/src/System.Reactive/Subjects/AsyncSubject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ private void Remove(AsyncSubjectDisposable inner)
break;
}

var b = default(AsyncSubjectDisposable[]);
AsyncSubjectDisposable[] b;
if (n == 1)
{
b = Array.Empty<AsyncSubjectDisposable>();
Expand Down
2 changes: 1 addition & 1 deletion Rx.NET/Source/src/System.Reactive/Subjects/Subject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ private void Unsubscribe(SubjectDisposable observer)
break;
}

var b = default(SubjectDisposable[]);
SubjectDisposable[] b;
if (n == 1)
{
b = Array.Empty<SubjectDisposable>();
Expand Down