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
Arvind Chourasiya
NA
933
134.4k
can anyone explain me this piece code?
May 28 2016 9:02 AM
public class Cat : Entity
{
private string _name;
public string Name
{
get { return _name; }
set
{
if (value.Equals(_name))
{
return;
}
_name = value;
OnPropertyChanged();
}
}
}
Entity class:
public void OnPropertyChanged([CallerMemberName] string propertyName = null)
{
var handler = PropertyChanged;
handler?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
So here,
1) ^^^
private string _name;
public string Name
{
get { return _name; }
set
{
if (value.Equals(_name))
{
return;
}
_name = value;
OnPropertyChanged();
}
}
2)^^^
public string Name{get;set}
so what is the difference between 1 and 2. can replace cat class all code 1^^^ with code 2^^^
Reply
Answers (
3
)
how to generate report client wise in c#
Control Events not Opening in .CS page in ASP.net