> For the complete documentation index, see [llms.txt](https://beytullahakyuz.gitbook.io/securebase/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://beytullahakyuz.gitbook.io/securebase/.net/usage.md).

# Usage

{% tabs %}
{% tab title="Text" %}

```csharp
//SecureBase.SBEncoding sbencoding = SecureBase.SBEncoding.UNICODE;
SecureBase.SBEncoding sbencoding = SecureBase.SBEncoding.UTF8;

SecureBase bs = new SecureBase(sbencoding);
bs.SetSecretKey(secretkey);

//Encoding
string encodeddata = bs.Encode(data);

//Decoding
string decodeddata = bs.Decode(data);
```

{% endtab %}

{% tab title="File" %}

```csharp
SecureBase sb = new SecureBase(SecureBase.SBEncoding.UTF8);
sb.SetSecretKey("xcompany-secret-key");

//Encoding
string filedata = File.ReadAllText("data.txt");
File.WriteAllText("encoded.txt", sb.Encode(filedata));

//Decoding
string fileencoded = File.ReadAllText("encoded.txt");
File.WriteAllText("decoded.txt", sb.Decode(fileencoded));
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
You can examine sample usage via the [SecureBaseApp](https://github.com/beytullahakyuz/securebase-dotnet/tree/main/demos/SecureBaseApp/SecureBaseApp) application on [Github](https://github.com/beytullahakyuz/securebase-dotnet).
{% endhint %}

***
