I am creating an application that takes input from user and save it permanently in form of table.

```
    Console.Write("\n\tEnter roll no\n\t");  
    v= Convert.ToInt32(Console.ReadLine());  
    a[i].setroll(v);  
    Console.Write("\n\tEnter name\n\t");  
    k = Console.ReadLine();  
    a[i].setname(k);  
    Console.Write("\n\tEnter father name\n\t");  
    k = Console.ReadLine();  
    a[i].setfname(k);  
    Console.Write("\n\tEnter CNIC NO\n\t ");  
    k = Console.ReadLine();  
    a[i].setcnic(k);  
    Console.Write("\n\tEnter permanent address\n\t");  
    k = Console.ReadLine();  
    a[i].setpaddress(k);   
    Console.Write("\n\tEnter present address\n\t");    
    k = Console.ReadLine();    

```

I want to save all this info entered by user to be used later. How can I do this?
['https://Stackoverflow.com/questions/29714078', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/4663076/']
Refer to [System.IO.File](https://msdn.microsoft.com/en-us/library/System.IO.File(v=vs.110).aspx) 

And this may be a quick help:

```
using System;
public class Test
{
    public static void Main()
    {
        String Str = "";

        for(int i =0;i<10;i++)
        {
            Str += i.ToString();
        }
        Console.WriteLine(Str);
        System.IO.File.WriteAllText(@"C:\SaveInfo.Txt",Str);
    }
}

```
First you have to create an string array with your data then you can write it to the txt file 

```
string[] lines = { "First line", "Second line", "Third line" };

```

WriteAllLines creates a file, writes a collection of strings to the file,and then closes the file.

```
System.IO.File.WriteAllLines(@"C:\Users\Public\TestFolder\WriteLines.txt",lines);

```

[How to: Write to a Text File (C# Programming Guide)](https://msdn.microsoft.com/en-us/library/8bh11f1k.aspx)