本文整理汇总了C#中TextReader.ReadObject方法的典型用法代码示例。如果您正苦于以下问题:C# TextReader.ReadObject方法的具体用法?C# TextReader.ReadObject怎么用?C# TextReader.ReadObject使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TextReader
的用法示例。
在下文中一共展示了TextReader.ReadObject方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ObjectFromString
/// <summary>
/// Reads and returns a domain object from the specified DDL string.
/// </summary>
public static DocumentObject ObjectFromString(string ddl, DdlReaderErrors errors)
{
StringReader stringReader = null;
DocumentObject domObj = null;
DdlReader reader = null;
try
{
stringReader = new StringReader(ddl);
reader = new DdlReader(stringReader);
domObj = reader.ReadObject();
}
finally
{
if (stringReader != null)
stringReader.Close();
if (reader != null)
reader.Close();
}
return domObj;
}
示例2: ObjectFromFile
/// <summary>
/// Reads and returns a domain object from the specified file.
/// </summary>
public static DocumentObject ObjectFromFile(string documentFileName, DdlReaderErrors errors)
{
DdlReader reader = null;
DocumentObject domObj = null;
try
{
reader = new DdlReader(documentFileName, errors);
domObj = reader.ReadObject();
}
finally
{
if (reader != null)
reader.Close();
}
return domObj;
}