Skip to main content
se añadieron 15 caracteres en el cuerpo
Origen Enlace
J. Castro
  • 2.5k
  • 8
  • 21
  • 32

Intenta con esto:

int counter = 0;  
string line;
// Lee la fila y muestra en pantalla linea por linea.
System.IO.StreamReader file = new System.IO.StreamReader(@"c:\test.txt"); 
while((line = file.ReadLine()) != null)  {
    System.Console.WriteLine (line);  
    counter++;   
}
file.Close(); 
System.Console.WriteLine("There were {0} lines.", counter); 
// Suspende.
System.Console.ReadLine(); 

Intenta con esto

int counter = 0;  
string line;
// Lee la fila y muestra en pantalla linea por linea.
System.IO.StreamReader file = new System.IO.StreamReader(@"c:\test.txt"); 
while((line = file.ReadLine()) != null)  {
System.Console.WriteLine (line);  
counter++;  }
file.Close(); 
System.Console.WriteLine("There were {0} lines.", counter); 
// Suspende.
System.Console.ReadLine(); 

Intenta con esto:

int counter = 0;  
string line;
// Lee la fila y muestra en pantalla linea por linea.
System.IO.StreamReader file = new System.IO.StreamReader(@"c:\test.txt"); 
while((line = file.ReadLine()) != null)  {
    System.Console.WriteLine (line);  
    counter++;   
}
file.Close(); 
System.Console.WriteLine("There were {0} lines.", counter); 
// Suspende.
System.Console.ReadLine(); 
Origen Enlace

Intenta con esto

int counter = 0;  
string line;
// Lee la fila y muestra en pantalla linea por linea.
System.IO.StreamReader file = new System.IO.StreamReader(@"c:\test.txt"); 
while((line = file.ReadLine()) != null)  {
System.Console.WriteLine (line);  
counter++;  }
file.Close(); 
System.Console.WriteLine("There were {0} lines.", counter); 
// Suspende.
System.Console.ReadLine();