# SessionFile class

Namespace: [Grasshopper2.Doc](https://developer.rhino3d.com/api/gh2/namespace/grasshopper2.doc.md) · Assembly: [Grasshopper2](https://developer.rhino3d.com/api/gh2/assembly/grasshopper2.md)

```cs
public static class SessionFile
```

Static helpers for capturing, persisting and restoring a [SessionRecord](https://developer.rhino3d.com/api/gh2/type/grasshopper2.doc.sessionrecord.md) on disk. The on-disk record lives in [Folders.LocalAppDataFolder](https://developer.rhino3d.com/api/gh2/type/grasshopper2.folders/localappdatafolder.md) and is written at shutdown; the next startup reads it and reinstates the documents that were open when the previous session ended.

## Fields

- [FileName](https://developer.rhino3d.com/api/gh2/type/grasshopper2.doc.sessionfile/filename.md): (static) On-disk filename used to persist the session record.

## Properties

- [Path](https://developer.rhino3d.com/api/gh2/type/grasshopper2.doc.sessionfile/path.md): (static) Full path to the session record file.

## Methods

- [CaptureCurrent](https://developer.rhino3d.com/api/gh2/type/grasshopper2.doc.sessionfile/capturecurrent.md): (static) Build a fresh [SessionRecord](https://developer.rhino3d.com/api/gh2/type/grasshopper2.doc.sessionrecord.md) from the current state of a document bag. Every non-empty stack root is captured — named documents reference their on-disk path, unnamed documents reference their runtime identity and an autosave file under [Folders.UnnamedFilesFolder](https://developer.rhino3d.com/api/gh2/type/grasshopper2.folders/unnamedfilesfolder.md).
- [TryDelete](https://developer.rhino3d.com/api/gh2/type/grasshopper2.doc.sessionfile/trydelete.md): (static) Delete the session record file. The restore path no longer calls this; the next clean shutdown overwrites the record. Available for explicit "forget my session" operations.
- [TryLoad](https://developer.rhino3d.com/api/gh2/type/grasshopper2.doc.sessionfile/tryload.md): (static) Read the session record from disk, or return null if no record exists or the file could not be read.
- [TrySave](https://developer.rhino3d.com/api/gh2/type/grasshopper2.doc.sessionfile/trysave.md): (static) Write the supplied record to [SessionFile.Path](https://developer.rhino3d.com/api/gh2/type/grasshopper2.doc.sessionfile/path.md), replacing any existing file.
