i can't set the string value

  • Thread starter Thread starter Stone Zou
  • Start date Start date
S

Stone Zou

Hi:
i wrote code like following:
public class Class1
{
private String datapath ;
public String Datapath
{
get
{
return datapath;
}
set
{
setStringParam(value,datapath);
}
}
private void setStringParam(String val,String source)
{
if( val != null)
source =(String) val.Clone();
else
source = "";
}
}
}
and test function like
Class1 tmp = new Class1();
tmp.Datapath = "hello";
textBox1.Text = tmp.Datapath;


but the value of textBox1.Text is null, what happen?
thanks
stone
 
Stone Zou said:
Hi:
i wrote code like following:
public class Class1
{
private String datapath ;
public String Datapath
{
get
{
return datapath;
}
set
{
setStringParam(value,datapath);
}
}

Why not just:

datapath = value;

and not using setStringParam at all?

Hans Kamp.
 
Back
Top