# < Summary

Information

Class: | Renci.SshNet.Common.AsyncResult<T>
Assembly: | Renci.SshNet
File(s): | \home\appveyor\projects\ssh-net\src\Renci.SshNet\Common\AsyncResult{TResult}.cs

Line coverage
100%

Covered lines: | 11
Uncovered lines: | 0
Coverable lines: | 11
Total lines: | 50
Line coverage: | 100%

Branch coverage
N/A

Covered branches: | 0
Total branches: | 0
Branch coverage: | N/A

Method coverage

Feature is only available for sponsors

Upgrade to PRO version

# Metrics

Method | Branch coverage | Cyclomatic complexity | Line coverage
--- | --- | --- | ---
.ctor(...) | 100% | 1 | 100%
SetAsCompleted(...) | 100% | 1 | 100%
EndInvoke() | 100% | 1 | 100%

# File(s)

## \home\appveyor\projects\ssh-net\src\Renci.SshNet\Common\AsyncResult{TResult}.cs

| # | Line |  | Line coverage
--- | --- | --- | --- | ---
|  | `1` |  | `using System;`
|  | `2` |  | ``
|  | `3` |  | `namespace Renci.SshNet.Common`
|  | `4` |  | `{`
|  | `5` |  | `/// <summary>`
|  | `6` |  | `/// Base class to encapsulates the results of an asynchronous operation that returns result.`
|  | `7` |  | `/// </summary>`
|  | `8` |  | `/// <typeparam name="TResult">The type of the result.</typeparam>`
|  | `9` |  | `public abstract class AsyncResult<TResult> : AsyncResult`
|  | `10` |  | `{`
|  | `11` |  | `// Field set when operation completes`
|  | `12` |  | `private TResult _result;`
|  | `13` |  | ``
|  | `14` |  | `/// <summary>`
|  | `15` |  | `/// Initializes a new instance of the <see cref="AsyncResult{TResult}"/> class.`
|  | `16` |  | `/// </summary>`
|  | `17` |  | `/// <param name="asyncCallback">The async callback.</param>`
|  | `18` |  | `/// <param name="state">The state.</param>`
|  | `19` |  | `protected AsyncResult(AsyncCallback asyncCallback, object state)`
| 4299 | `20` |  | `: base(asyncCallback, state)`
| 4299 | `21` |  | `{`
| 4299 | `22` |  | `}`
|  | `23` |  | ``
|  | `24` |  | `/// <summary>`
|  | `25` |  | `/// Marks asynchronous operation as completed.`
|  | `26` |  | `/// </summary>`
|  | `27` |  | `/// <param name="result">The result.</param>`
|  | `28` |  | `/// <param name="completedSynchronously">if set to <see langword="true"/> [completed synchronously].</param>`
|  | `29` |  | `public void SetAsCompleted(TResult result, bool completedSynchronously)`
| 4191 | `30` |  | `{`
|  | `31` |  | `// Save the asynchronous operation's result`
| 4191 | `32` |  | `_result = result;`
|  | `33` |  | ``
|  | `34` |  | `// Tell the base class that the operation completed successfully (no exception)`
| 4191 | `35` |  | `SetAsCompleted(exception: null, completedSynchronously);`
| 4191 | `36` |  | `}`
|  | `37` |  | ``
|  | `38` |  | `/// <summary>`
|  | `39` |  | `/// Waits until the asynchronous operation completes, and then returns the value generated by the asynchronous o`
|  | `40` |  | `/// </summary>`
|  | `41` |  | `/// <returns>`
|  | `42` |  | `/// The invocation result.`
|  | `43` |  | `/// </returns>`
|  | `44` |  | `public new TResult EndInvoke()`
| 4222 | `45` |  | `{`
| 4222 | `46` |  | `base.EndInvoke(); // Wait until operation has completed`
| 4190 | `47` |  | `return _result; // Return the result (if above didn't throw)`
| 4190 | `48` |  | `}`
|  | `49` |  | `}`
|  | `50` |  | `}`

# Methods/Properties

.ctor(System.AsyncCallback,System.Object)
SetAsCompleted(TResult,System.Boolean)
EndInvoke()