hello every one...

i'm very new to c#

in the following program (Console application prg.)

i want to get "int" value

of "eno","ph_no" in place of string type


but i don't know how to convert string type to "int"

type

if i use like

eno=(int)console.readLine();

then it will give error like "implicit conversion error"

i have search so many web site but i can't get proper answer

so please help me to solve it out

using System;

class emp
{
    string ename,eno,ph_no;
    //int eno,ph_no;

    public void get_data()
    {

    
        Console.WriteLine("\n\nEnter Employee Number :");
        eno = Console.ReadLine();//want int value ???
        Console.WriteLine("\nEnter The Employee Name: ");
        ename = Console.ReadLine();
        Console.WriteLine("\nEnter The Employee Ph. No: ");
        ph_no  = Console.ReadLine();//want int value ??

    }

    public void put_data()
    {
        Console.WriteLine("---------------------------------------------");
        Console.WriteLine("OUT PUT IS");
        Console.WriteLine("---------------------------------------------");
        Console.WriteLine("\nEnter Employee Number    : "+eno );
        Console.WriteLine("\nEnter The Employee Name  : "+ename );
        Console.WriteLine("\nEnter The Employee Ph. No: "+ph_no );

    }

}

public class big
{
    public static void Main()
    {

        emp obj= new emp();

        obj.get_data();
        obj.put_data();
    }

}

You have several options here :
If eno is an int then:
eno = Convert.ToInt32(Console.ReadLine());
or
eno = int.Parse(Console.ReadLine());
or
bool succes = int.TryParse(Console.ReadLine(), out eno);

@ddanbe

thank you so much.

whould u pls tell me which web site should i prefer for

" learning of c#"

You have several options here :
If eno is an int then:
eno = Convert.ToInt32(Console.ReadLine());
or
eno = int.Parse(Console.ReadLine());
or
bool succes = int.TryParse(Console.ReadLine(), out eno);

This question has already been answered. Start a new discussion instead.