How to read GH_file in c#?

Hi all,
how can the gh_file can be read.
i tried.

GH_Document doc = new GH_Document();
string path = @"D:\Grasshopper\Grasshopper_File\sqlite_vs_01.gh";
doc.FilePath = path;
                    
A = doc.Objects.Count;

its 0 but there are defently more objects.

GH_DocumentIO io = new GH_DocumentIO();
    io.Open(filepath);
    GH_Document document = io.Document;
    A = document.Objects.Count;

seems to work

Thanks Baris.