What is Parse in c#

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • cypercop007
    New Member
    • Sep 2008
    • 1

    What is Parse in c#

    Hello

    I am new to this Software world

    But i am interested in . net C#

    Please guide me you all o k

    I need a clear explanation with Basic example and program output in C# about parse

    That is, i came to know parse by viewing the code

    float total = float.Parse (textBox1.Text) ;
    float factor = float.Parse (textBox2.Text) ;

    lbResult.Text = (total) + (total*factor). ToString();

    What you meant was:

    lbResult.Text = (total + total*factor).T oString();

    Please explain what is parse, what it may do, where we use it

    o k

    Sorry for the Disturbance

    Please answer my question and make me grow with you all

    Thanks and Regards

    by

    S.Jeevagan
  • ssg31415926
    New Member
    • Sep 2008
    • 2

    #2
    Usually, when you are parsing data, you are taking it in one form and trying to understand it in another form. In this case, the data is arriving as a string (TextBox.Text) and you need it as a number, specifically a float.

    A float, in C#, is a System.Single. If you look up Single.Parse in the documentation, you will see that it "Converts the string representation of a number to its single-precision floating-point number equivalent".

    Comment

    Working...