TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
C# Corner
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Adding Data to an Object
Ujjwal Patel
Jan 19
2015
Code
790
0
0
facebook
twitter
linkedIn
Reddit
WhatsApp
Email
Bookmark
expand
using
System;
using
System.Collections.Generic;
using
System.Linq;
using
System.Text;
using
System.Threading.Tasks;
namespace
TestingOops
{
class
Employee
{
public
int
Empage
{
get
;
set
;
}
public
string
Empname
{
get
;
set
;
}
public
string
Empphonenumber
{
get
;
set
;
}
public
double
Empsalary
{
get
;
set
;
}
}
class
Program
{
static
void
Main(
string
[] args)
{
Employee emp =
new
Employee
{
Empage=32,
Empname=
"Ujjwal"
,
Empphonenumber=
"9031-214-542"
,
Empsalary=50000
};
Console.WriteLine(
"Employee Name is : \'{0}\' and Age is {1}. {0} gets salary of $ {2} and his phone number is {3}"
,emp.Empname,emp.Empage,emp.Empsalary,emp.Empphonenumber);
Console.ReadKey();
}
}
}
C#
Object
Data