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();
}
}