---
product: Chilkat
product_version: 11.7.0
language: csharp
language_label: C#
class: StreamConnector
license: free
deprecated: false
reference_html: https://www.chilkatsoft.com/refdoc/csStreamConnectorRef.html
---
# Chilkat StreamConnector — C# — v11.7.0

> Chilkat 11.7.0 · language=csharp · class=StreamConnector
> Other versions: replace `11.7.0` in this URL. Other languages: `https://www.chilkatsoft.com/ai-docs/v/11.7.0/<lang>/classes/StreamConnector.md`.
> Language-wide rules (install, unlock, error model, strings/bytes): `https://www.chilkatsoft.com/ai-docs/v/11.7.0/csharp/guide.md`.

## Purpose

This is a utility class that makes it possible to use System.IO.Stream objects with Chilkat.

Note: This class is not available in .NET Core or Mono.

## Object creation, unlocking and error handling

**Object Creation**

```csharp
Chilkat.StreamConnector obj = new Chilkat.StreamConnector();
```

Call `Global.UnlockBundle` once at the start of the program, before using this or any other Chilkat class. Any string unlocks a fully functional 30-day trial; a purchased unlock code is used in production. See `guide.md` for the exact code in C#.

Minimal complete program:

```csharp
// Required once per process. Any string unlocks a 30-day trial; use your purchased code in production.
Chilkat.Global glob = new Chilkat.Global();
if (!glob.UnlockBundle("Anything for 30-day trial"))
{
    Console.WriteLine(glob.LastErrorText);
    return;
}

Chilkat.StreamConnector streamConnector = new Chilkat.StreamConnector();
```

How failure is reported depends on the method's return type and is stated in the note under each method below. In every case the diagnostic text is in the `LastErrorText` property of the object whose method was called.

## Member index

| Member | Kind | Signature |
|---|---|---|
| `SetAsSink` | method | `public bool SetAsSink(System.IO.Stream dnStream, Stream strm);` |
| `SetAsSource` | method | `public bool SetAsSource(System.IO.Stream dnStream, Stream strm);` |

## Methods

### StreamConnector.SetAsSink

`Chilkat 11.7.0 · csharp · StreamConnector · SetAsSink · method · since 9.5.0.56`

```csharp
public bool SetAsSink(System.IO.Stream dnStream, Stream strm);
```

Sets the `dnStream` to be the sink of `strm`.

Returns true for success, false for failure.

### StreamConnector.SetAsSource

`Chilkat 11.7.0 · csharp · StreamConnector · SetAsSource · method · since 9.5.0.56`

```csharp
public bool SetAsSource(System.IO.Stream dnStream, Stream strm);
```

Sets the `dnStream` to be the source of `strm`.

Returns true for success, false for failure.

## Related classes

[`Stream`](https://www.chilkatsoft.com/ai-docs/v/11.7.0/csharp/classes/Stream.md)

