1) Clear() is a built-in method in C# that is used to clear the contents of a text box or any other control in a GUI application.
Example: textBox1.Clear(); // clears the contents of textBox1 control
Package/library: System.Windows.Forms
2) Clear() can also be used to clear the contents of a collection or list.
Example: List numbers = new List {1, 2, 3, 4}; numbers.Clear(); // clears all elements from the list
Package/library: System.Collections.Generic
3) Clear() can also be used to clear the error state of an exception object.
Example: try { // some code that might throw an exception } catch (Exception ex) { // clear the error state of the exception object ex.Clear(); }
Package/library: System
C# (CSharp) this.Clear - 30 examples found. These are the top rated real world C# (CSharp) examples of this.Clear extracted from open source projects. You can rate examples to help us improve the quality of examples.