本文整理汇总了C#中Serialization.Deserialize方法的典型用法代码示例。如果您正苦于以下问题:C# Serialization.Deserialize方法的具体用法?C# Serialization.Deserialize怎么用?C# Serialization.Deserialize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Serialization
的用法示例。
在下文中一共展示了Serialization.Deserialize方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FakeSettingRepository
public FakeSettingRepository()
{
const string settingsData = @"<?xml version='1.0'?>
<Setting xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xsd='http://www.w3.org/2001/XMLSchema'>
<SettingsCacheTimeInMinutes>5</SettingsCacheTimeInMinutes>
<GridPageSize>10</GridPageSize>
<ShowContentEllipsis>true</ShowContentEllipsis>
<ContentExtractLength>15</ContentExtractLength>
<AllowRejectedContentReActivation>false</AllowRejectedContentReActivation>
<AllowExpiredContentReActivation>true</AllowExpiredContentReActivation>
</Setting>";
var serializer = new Serialization();
_list.Add(serializer.Deserialize(settingsData, typeof(Setting).ToString()) as Setting);
}
示例2: Get
/// <summary>
/// Returns all records of type T.
/// </summary>
public IQueryable<HtmlContent> Get()
{
db.Connect();
ICursor result = db["ContentManager"]["Content"].FindAll();
List<HtmlContent> resultList = new List<HtmlContent>();
var serializer = new Serialization();
foreach (var document in result.Documents)
{
var reader = document["Data"].ToString();
HtmlContent contentItem = serializer.Deserialize(reader, typeof(HtmlContent).ToString()) as HtmlContent;
resultList.Add(contentItem);
}
return resultList.AsQueryable();
}