Tech
Forums
Jobs
Books
Events
Interviews
Live
More
Learn
Training
Career
Members
Videos
News
Blogs
Login
Sign Up
Ask Question
3
Reply
Object Instantiation in C# Programming
Praveen
Jul 6 2017 1:13 AM
326
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
Upload Source Code
Select only zip and rar file.
Post
Reset
Answers (
3
)
Sliding A Panel
how to export two gridviews in same excel but differentsheet