---
id: "P:cAlgo.API.File.Extension"
kind: "property"
type: "T:cAlgo.API.File"
url: "https://help.ctrader.com/ctrader-algo/references/Utility/File/Extension/"
---

> Documentation index for agents: https://help.ctrader.com/ctrader-algo/llms.txt · machine index: https://help.ctrader.com/ctrader-algo/api.json

# File.Extension

Member of [File](https://help.ctrader.com/ctrader-algo/references/Utility/File/index.md).

## Extension

Gets the extension part of the file name, including the leading dot '.' even if it is the entire file name, or an empty string if no extension is present.

Environments: Desktop supported · CLI supported · Cloud supported.

C#:

```csharp
string Extension {get;}
```

Python:

```python
file.Extension: str
```

### Returns

`string` — 

Available since cAlgo.API 5.7.

### Examples

C#:

```csharp
protected override void OnStart()
{
    if (DataFile.Extension != ".csv")
        Print("Expected a CSV file but got {0}", DataFile.Extension);
}
```

Python:

```python
if api.DataFile.Extension != ".csv":
    api.Print(f"Expected a CSV file but got {api.DataFile.Extension}")
```

config.json:

```json
{
  "Parameters": [
    {
      "Name": "DataFile",
      "DisplayName": "Data File",
      "Type": "File"
    }
  ]
}
```

