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
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Praveen Kumar
283
6.6k
2.3m
Object Instantiation in C# Programming
Jul 6 2017 1:13 AM
Object Instantiation in C# Programming
I have a class Greet and I am creating a object of this class by following two ways. Could you suggest me, which one is best way or both are same from the memory allocation point of view.
Kindly suggest the answer from the
memory allocation
point of view
class
Greet
{
public
string
SayHello()
{
return
"Hello Praveen"
;
}
}
static
void
Main(
string
[] args)
{
string
message =
""
;
//1. First Way
Greet greet =
new
Greet();
message=greet.SayHello();
//1. Second Way
message =
new
Greet().SayHello();
}
Reply
Answers (
3
)
Sliding A Panel
how to export two gridviews in same excel but differentsheet