SHARE
TWEET

Untitled

a guest Feb 17th, 2017 57 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. StreamWriter writer = null;
  2.                     StringBuilder strbuilder = null;
  3.                     string dir = Application.StartupPath;
  4.                     if (!Directory.Exists(dir))
  5.                     {
  6.                         Directory.CreateDirectory(dir);
  7.                     }
  8.  
  9.  
  10.                     string path = Path.Combine(dir, "test.csv");
  11.                     strbuilder = new StringBuilder();
  12.                     strbuilder.Append("n");
  13.                     foreach (var a in listofuser)
  14.                     {
  15.  
  16.                         strbuilder.Append(a.SystemUserID.ToString() + "," + a.FullName.ToString() + "," + a.Department.ToString() +","+ Environment.NewLine);
  17.  
  18.                     }
  19.  
  20.  
  21.                     writer = new StreamWriter(path, true);
  22.                     writer.Write(strbuilder);
  23.                     writer.Close();
RAW Paste Data
Top