NDK
11-27-2009, 11:04 AM
Hi,
i'm programming for the first time in .NET (C#)
I was wondering, what is the good solution to write getters en setters?
Is this:
public void getVar(){
return m_var;
}
public String setVar(String newVar){
m_var = newVar;
}
or
public String var
{
get
{
return m_var;
}
set
{
m_var = value;
}
}
or are both solutions correct?
And if there is only one solution, can you explain why i can't use the other one?
tnx
i'm programming for the first time in .NET (C#)
I was wondering, what is the good solution to write getters en setters?
Is this:
public void getVar(){
return m_var;
}
public String setVar(String newVar){
m_var = newVar;
}
or
public String var
{
get
{
return m_var;
}
set
{
m_var = value;
}
}
or are both solutions correct?
And if there is only one solution, can you explain why i can't use the other one?
tnx