System.IO.TextReader.Read C# (CSharp) Method

Read() public method

public Read ( ) : int
return int
        public virtual int Read()
        {
            return -1;
        }

Same methods

TextReader::Read ( char buffer, int index, int count ) : int

Usage Example

		public static string CalculateIndent(TextReader code, int line, bool tabsToSpaces = false, int indentWidth = 4)
		{
			if(line < 2)
				return string.Empty;
			
			var eng = new IndentEngine(DFormattingOptions.CreateDStandard(), tabsToSpaces, indentWidth);
			
			int curLine = 1;
			const int lf = (int)'\n';
			const int cr = (int)'\r';
			int c;
			while((c = code.Read()) != -1)
			{
				if(c == lf || c == cr)
				{
					if(c == cr && code.Peek() == lf)
						code.Read();
					
					if(++curLine > line)
						break;
				}
				
				eng.Push((char)c);
			}
			
			return eng.ThisLineIndent;
		}
All Usage Examples Of System.IO.TextReader::Read