本文整理汇总了C#中ISerializer.Load方法的典型用法代码示例。如果您正苦于以下问题:C# ISerializer.Load方法的具体用法?C# ISerializer.Load怎么用?C# ISerializer.Load使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ISerializer
的用法示例。
在下文中一共展示了ISerializer.Load方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DataBase
public DataBase(string dbDirPath)
{
serializer = new Serializer ();
dbName = Path.GetFileNameWithoutExtension (dbDirPath);
dbPath = Path.Combine (dbDirPath, Path.GetFileName (dbDirPath));
this.dbDirPath = dbDirPath;
if (!Directory.Exists (dbDirPath)) {
Directory.CreateDirectory (dbDirPath);
}
if (File.Exists (dbPath)) {
try {
projectsDB = serializer.Load<LiteDB> (dbPath);
projectsDB.DBPath = dbPath;
} catch (Exception e) {
Log.Exception (e);
}
}
if (projectsDB == null) {
Reload ();
}
DateTime now = DateTime.UtcNow;
if (projectsDB.LastBackup + maxDaysWithoutBackup < now) {
Backup ();
}
}
示例2: HomeController
public HomeController()
{
_serializer = new JsonSerializer();
var list = _serializer.Load<List<String>>(@"query/statistic.json");
uploadTime = list[0];
uploadCount = list[1];
}
示例3: Load
public void Load( ISerializer sut )
{
Assert.IsType<Serializer>( sut );
var stream = new MemoryStream( Encoding.UTF8.GetBytes( Expected ) );
var loaded = Assert.IsType<ClassWithProperty>( sut.Load<ClassWithProperty>( stream ) );
Assert.Equal( "Property2a258824-6489-4cd5-92e9-d6dd98d76002", loaded.Property );
}