【发布时间】:2015-07-16 05:36:30
【问题描述】:
是否应该明确处置 libgit2sharp Repository 对象?
如果不总是通过Repository.Dispose() 执行清理,可能的负面后果是什么?非 GC 的 Repository 对象能否保留对各种 .git 文件的锁定?
最好将 Repository 对象包装在 using 语句中吗?
var localRepo = new Repository("{local repo path}", new RepositoryOptions());
using (localRepo) {
// checkout
// etc.
}
【问题讨论】:
标签: git repository dispose using-statement libgit2sharp