In my silverLight project I have a class on web side with few DateTime fields. I want to write Partial class for the class on client side which will return string instead of DateTime. How to write it?
This is what I tried. I added new string variable in Partial class which will get date field's and return string.
here is code:
public partial class abcd
{
DateTime date1;
public DateTime Date1
{
get { return date1; }
set { date1 = value; }
}
DateTime date2;
public DateTime Date2
{
get { return date2; }
set { date2 = value; }
}
}
public partial class abcd
{
string date1Str;
public string Date1Str
{
get { return Date1Str; }
set { date2 = Date1.ToString(MM/dd/yyyy); }
}
}
I guess Date1Str
should be readonly and just look like this:
public string Date1Str
{
get { return date1.ToString("MM/dd/yyyy"); }
}