Skip to content

Commit db0300e

Browse files
committed
Use C# types.
1 parent 1b28947 commit db0300e

File tree

1 file changed

+22
-19
lines changed

1 file changed

+22
-19
lines changed

src/Renci.SshNet/Common/AsyncResult.cs

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,16 @@ public abstract class AsyncResult : IAsyncResult
1111
// Fields set at construction which never change while operation is pending
1212
private readonly AsyncCallback _asyncCallback;
1313

14-
private readonly Object _asyncState;
14+
private readonly object _asyncState;
1515

1616
// Field set at construction which do change after operation completes
17-
private const Int32 StatePending = 0;
17+
private const int StatePending = 0;
1818

19-
private const Int32 StateCompletedSynchronously = 1;
19+
private const int StateCompletedSynchronously = 1;
2020

21-
private const Int32 StateCompletedAsynchronously = 2;
21+
private const int StateCompletedAsynchronously = 2;
2222

23-
private Int32 _completedState = StatePending;
23+
private int _completedState = StatePending;
2424

2525
// Field that may or may not get set depending on usage
2626
private ManualResetEvent _asyncWaitHandle;
@@ -32,7 +32,7 @@ public abstract class AsyncResult : IAsyncResult
3232
/// Gets or sets a value indicating whether EndInvoke has been called on the current AsyncResult.
3333
/// </summary>
3434
/// <value>
35-
/// <c>true</c> if EndInvoke has been called on the current AsyncResult; otherwise, <c>false</c>.
35+
/// <c>true</c> if <see cref="EndInvoke()"/> has been called on the current <see cref="AsyncResult"/>; otherwise, <c>false</c>.
3636
/// </value>
3737
public bool EndInvokeCalled { get; private set; }
3838

@@ -41,7 +41,7 @@ public abstract class AsyncResult : IAsyncResult
4141
/// </summary>
4242
/// <param name="asyncCallback">The async callback.</param>
4343
/// <param name="state">The state.</param>
44-
protected AsyncResult(AsyncCallback asyncCallback, Object state)
44+
protected AsyncResult(AsyncCallback asyncCallback, object state)
4545
{
4646
_asyncCallback = asyncCallback;
4747
_asyncState = state;
@@ -52,7 +52,7 @@ protected AsyncResult(AsyncCallback asyncCallback, Object state)
5252
/// </summary>
5353
/// <param name="exception">The exception.</param>
5454
/// <param name="completedSynchronously">if set to <c>true</c> [completed synchronously].</param>
55-
public void SetAsCompleted(Exception exception, Boolean completedSynchronously)
55+
public void SetAsCompleted(Exception exception, bool completedSynchronously)
5656
{
5757
// Passing null for exception means no error occurred; this is the common case
5858
_exception = exception;
@@ -99,21 +99,21 @@ public void EndInvoke()
9999
/// Gets a user-defined object that qualifies or contains information about an asynchronous operation.
100100
/// </summary>
101101
/// <returns>A user-defined object that qualifies or contains information about an asynchronous operation.</returns>
102-
public Object AsyncState { get { return _asyncState; } }
102+
public object AsyncState { get { return _asyncState; } }
103103

104104
/// <summary>
105105
/// Gets a value that indicates whether the asynchronous operation completed synchronously.
106106
/// </summary>
107107
/// <returns>true if the asynchronous operation completed synchronously; otherwise, false.</returns>
108-
public Boolean CompletedSynchronously
108+
public bool CompletedSynchronously
109109
{
110110
get { return _completedState == StateCompletedSynchronously; }
111111
}
112112

113113
/// <summary>
114-
/// Gets a <see cref="T:System.Threading.WaitHandle"/> that is used to wait for an asynchronous operation to complete.
114+
/// Gets a <see cref="WaitHandle"/> that is used to wait for an asynchronous operation to complete.
115115
/// </summary>
116-
/// <returns>A <see cref="T:System.Threading.WaitHandle"/> that is used to wait for an asynchronous operation to complete.</returns>
116+
/// <returns>A <see cref="WaitHandle"/> that is used to wait for an asynchronous operation to complete.</returns>
117117
public WaitHandle AsyncWaitHandle
118118
{
119119
get
@@ -144,8 +144,9 @@ public WaitHandle AsyncWaitHandle
144144
/// <summary>
145145
/// Gets a value that indicates whether the asynchronous operation has completed.
146146
/// </summary>
147-
/// <returns>true if the operation is complete; otherwise, false.</returns>
148-
public Boolean IsCompleted
147+
/// <returns>
148+
/// <c>true</c> if the operation is complete; otherwise, <c>false</c>.</returns>
149+
public bool IsCompleted
149150
{
150151
get { return _completedState != StatePending; }
151152
}
@@ -162,11 +163,11 @@ public abstract class AsyncResult<TResult> : AsyncResult
162163
private TResult _result;
163164

164165
/// <summary>
165-
/// Initializes a new instance of the <see cref="AsyncResult&lt;TResult&gt;"/> class.
166+
/// Initializes a new instance of the <see cref="AsyncResult{TResult}"/> class.
166167
/// </summary>
167168
/// <param name="asyncCallback">The async callback.</param>
168169
/// <param name="state">The state.</param>
169-
protected AsyncResult(AsyncCallback asyncCallback, Object state)
170+
protected AsyncResult(AsyncCallback asyncCallback, object state)
170171
: base(asyncCallback, state)
171172
{
172173
}
@@ -176,19 +177,21 @@ protected AsyncResult(AsyncCallback asyncCallback, Object state)
176177
/// </summary>
177178
/// <param name="result">The result.</param>
178179
/// <param name="completedSynchronously">if set to <c>true</c> [completed synchronously].</param>
179-
public void SetAsCompleted(TResult result, Boolean completedSynchronously)
180+
public void SetAsCompleted(TResult result, bool completedSynchronously)
180181
{
181182
// Save the asynchronous operation's result
182183
_result = result;
183184

184185
// Tell the base class that the operation completed successfully (no exception)
185-
base.SetAsCompleted(null, completedSynchronously);
186+
SetAsCompleted(null, completedSynchronously);
186187
}
187188

188189
/// <summary>
189190
/// Waits until the asynchronous operation completes, and then returns the value generated by the asynchronous operation.
190191
/// </summary>
191-
/// <returns>Invocation result</returns>
192+
/// <returns>
193+
/// The invocation result.
194+
/// </returns>
192195
public new TResult EndInvoke()
193196
{
194197
base.EndInvoke(); // Wait until operation has completed

0 commit comments

Comments
 (0)