File Operations: (file and fileinfo, the former is a static method, perform security checks, suitable for an operation) 1.1.create: 1 using System; 2 using System. collections. generic; 3 using System. componentModel; 4 using System. data; 5 using System. drawing; 6 using System. linq; 7 using System. text; 8 using System. threading. tasks; 9 using System. windows. forms; 10 using System. IO; // This namespace contains class 11 12 namespace WindowsFormsApplication2 13 {14 public partial class Fo Rm1: Form 15 {16 public Form1 () 17 {18 InitializeComponent (); 19} 20 21 private void Form1_Load (object sender, EventArgs e) 22 {23 24} 25 26 private void button#click (object sender, EventArgs e) 27 {28 // determine whether the input file address is 29 if (textBox1.Text = string. empty) 30 {31 this. toolStripStatusLabel1.Text = "Enter the file to be created next to the red dot. "; 32 errorProvider1.SetError (textBox1," Enter the File to be created "); 33} 34 else 35 {36 if (File. exists (textBox1.Text. trim () // determine whether the file 37 {toolStripStatusLabel1.Text = "already exists. ";}38 else 39 {40 File. Create (textBox1.Text); // The static method creates the File 41 toolStripStatusLabel1.Text =" the File is created successfully! "+ TextBox1.Text +" "; 42} 43 44} 45} 46 47 private void button2_Click (object sender, EventArgs e) 48 {49 if (textBox2.Text = string. empty) 50 {51 // the following two sentences are prompted: 52 this. toolStripStatusLabel1.Text = "Enter the file to be created next to the red dot. "; 53 errorProvider1.SetError (textBox1," Enter the file to be created "); 54} 55 else 56 {57 FileInfo fi = new FileInfo (textBox2.Text. trim (); // instantiate 58 if (fi. exists) // the same as above also determines that 59 {60 toolStripStatusLabel1.Text = "already Exists. "; 61} 62 else 63 {fi. Create () ;}// Create this file 64} 65} 66} 67}