avatar
vimdur1

Guest 30 4th Dec, 2019

                                           
                         using System;  
using System.IO;    
using System.Collections.Generic;  
	class Program  
    {  
		
        static void Main(string[] args)  
        {  
		string name;
        var names = new List<string>();  
        names.Add("vimal");  
		names.Add("durai");
        foreach (var i in names)  
        {  
            Console.WriteLine(i);  
        }  
     
		DirectoryInfo directory = new DirectoryInfo(@"D:\student");    
        directory.Create();  
        Console.WriteLine("The directory is created successfully.");
		Console.WriteLine("enter the file name");
		name=Console.ReadLine();
		FileStream file=new FileStream(@"D:\student\"+name+".txt",FileMode.OpenOrCreate);
		StreamWriter s=new StreamWriter(file);
		foreach (var i in names)  
        {  
			s.Write(i);  
        }  
		s.Close();
		file.Close();
		}
	}
                      
                                       
To share this paste please copy this url and send to your friends
RAW Paste Data
Recent Pastes