Working with Parsing in C#

Working with Parsing I C# is quit simple

As per DotNet all predefined data types are predefined structures.

  • Structures is a collection of methods (function)
  • Maxvalue return the max capacity and minvalue return min capacity of a datatype.
  • Working with parse() is called as parsing.
  • Parsing can be used to convert string into another datatypes only

String -> int.Parse()
String -> byte.Parse()

Example 1: For printing the Limit of datatype

MessageBox.Show(int.MinValue.ToString());
MessageBox.Show(int.MaxValue.ToString());

Example 2: On Parsing:

private void button1_Click(object sender, EventArgs e)
{
      MessageBox.Show(txt1.Text + txt2.Text);
      int sal = int.Parse(txt1.Text);
      int inc = int.Parse(txt2.Text);
      int total = sal + inc;
      MessageBox.Show(total.ToString()); 
}

Ebook Download
View all
Learn
View all