Click here to Skip to main content
15,880,891 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
Hi,

I am new to WPF can anyone explain get set property regarding below questions and program,

1)why we are assigning private and public,
2)what is the use of get and set keyword,
3)what value we are returning in get,
4)why we are using "value",
5)what is the use of RaisePropertyChanged()
6)What is the link between xamal file and cs file by assigning Text="{Binding Path=FirstName}" in xamal file

C#
public class Person
{
    public string FirstName { get; set; }
} 

public class MainViewModel : ViewModelBase
{
  private const string FirstNamePropertyName = "FirstName";
    public string FirstName
    {
        get
        {
            return _newPerson.FirstName;
        }
        set
        {
            _newPerson.FirstName = value;
            RaisePropertyChanged(FirstNamePropertyName);
        }
    }
}






Thanks in advance...
R.Karthik
Posted

1 solution

1.why we are assigning private and public
PUBLIC-The type or member can be accessed by any other code in the same assembly or another assembly that references it.
PRIVATE-
The type or member can be accessed only by code in the same class or struct.

2)what is the use of get and set keyword?
3)what value we are returning in get?

Answer..
http://msdn.microsoft.com/en-in/library/aa287786(v=vs.71).aspx

5)what is the use of RaisePropertyChanged()?

Safest way to use RaisePropertyChanged method
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900