I am very new to the language. This code is giving me error:
Cannot create an instance of the static class 'System.Tuple'
Operator '!=' cannot be applied to operands of type 'bool' and 'int'
I don't know what I am doing wrong. Can some tell me what is wrong
using(StreamReader rdr = new StreamReader("fileName"))
{
StringBuilder sb = new StringBuilder();
Int32 nc = 0;
Char c;
Int32 lineNumber = 0;
while( (nc == rdr.Read() !=-1 ))
{
c = (Char)nc;
if( Char.IsWhiteSpace(c) )
{
if( sb.Length > 0 )
{
yield return new Tuple( sb.ToString(), lineNumber );
sb.Length = 0;
}
if( c == '\n' ) lineNumber++;
}
else
{
sb.Append( c );
}
}
if( sb.Length > 0 ) yield return new Tuple( sb.ToString(), lineNumber );
}