C# TextReader.ReadToEnd的代码示例
通过代码示例来学习C# TextReader.ReadToEnd方法
通过代码示例来学习编程是非常高效的。
1. 代码示例提供了一个具体而直观的学习环境,使初学者能够立即看到编程概念和语法的实际应用。
2. 通过分析和模仿现有的代码实例,初学者可以更好地理解编程逻辑和算法的工作原理。
3. 代码实例往往涵盖了多种编程技巧和最佳实践,通过学习和模仿这些实例,学习者可以逐步掌握如何编写高效、可读性强和可维护的代码。这对于初学者来说,是一种快速提升编程水平的有效途径。
TextReader.ReadToEnd是C#的System.IO命名空间下中的一个方法, 小编为大家找了一些网络大拿们常见的代码示例,源码中的TextReader.ReadToEnd() 已经帮大家高亮显示了,大家可以重点学习TextReader.ReadToEnd() 方法的写法,从而快速掌握该方法的应用。
TextReader.ReadToEnd的代码示例1 - DetectEncoding()
using System.IO; ///
/// Detects the encoding of an HTML text provided on a TextReader. /// /// The TextReader used to feed the HTML. May not be null. ///The detected encoding. public Encoding DetectEncoding(TextReader reader) { if (reader == null) { throw new ArgumentNullException("reader"); } _onlyDetectEncoding = true; if (OptionCheckSyntax) { Openednodes = new Dictionary(); } else { Openednodes = null; } if (OptionUseIdAttribute) { Nodesid = new Dictionary (StringComparer.OrdinalIgnoreCase); } else { Nodesid = null; } StreamReader sr = reader as StreamReader; if (sr != null && !_useHtmlEncodingForStream) { Text = sr.ReadToEnd(); _streamencoding = sr.CurrentEncoding; return _streamencoding; } _streamencoding = null; _declaredencoding = null; Text = reader.ReadToEnd(); _documentnode = CreateNode(HtmlNodeType.Document, 0); // this is almost a hack, but it allows us not to muck with the original parsing code try { Parse(); } catch (EncodingFoundException ex) { return ex.Encoding; } return _streamencoding; }
开发者ID:zzzprojects,项目名称:html-agility-pack,代码行数:60,代码来源:HtmlDocument.cs
在DetectEncoding()方法中,TextReader的代码示例类中的ReadToEnd的代码示例方法一共出现了2次, 见黄色背景高亮显示的地方,欢迎大家点赞
TextReader.ReadToEnd的代码示例2 - Load()
using System.IO; ///
/// Loads the mixed code document from the specified TextReader. /// /// The TextReader used to feed the HTML data into the document. public void Load(TextReader reader) { _codefragments.Clear(); _textfragments.Clear(); // all pseudo constructors get down to this one using (StreamReader sr = reader as StreamReader) { if (sr != null) { _streamencoding = sr.CurrentEncoding; } _text = reader.ReadToEnd(); } Parse(); }
开发者ID:zzzprojects,项目名称:html-agility-pack,代码行数:24,代码来源:MixedCodeDocument.cs
在Load()方法中,TextReader的代码示例类中的ReadToEnd的代码示例方法一共出现了1次, 见黄色背景高亮显示的地方,欢迎大家点赞
本文中的TextReader.ReadToEnd方法示例由csref.cn整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。