我正在读回一些属性到对象的构造函数中。其中一个属性是对另一个属性的计算。如何添加分配计算的属性值到对象?
但是,当我创建这个对象计算Implementation_End_String
属性值总是空:
private string implementationEndString;
public string Implementation_End_String {
get{
return implementationEndString;
}
set {
implementationEndString= DataTimeExtensions.NullableDateTimeToString(Implementation_End);
}
}
问:
你怎么可以在计算特性传递给对象的构造函数?
这是构造函数的依据和计算性能:
private string implementationEndString;
public string Implementation_End_String {
get{
return implementationEndString;
}
set {
implementationEndString= DataTimeExtensions.NullableDateTimeToString(Implementation_End);
}
}
public DateTime? Implementation_End { get; set; }
public ReleaseStatus(DateTime? implementationEnd)
{
//value is assigned at runtime
Implementation_End = changeRequestPlannedImplementationEnd;
}
的[?什么是一个NullReferenceException,以及如何解决呢(可能的复制http://stackoverflow.com/questions/4660142/what-is-a-nullreferenceexception-and-how-do-i-fix-it) – mybirthname