मैं nullable
दिनांक में वर्ष की गणना कैसे कर सकता हूं?वर्ष में शून्य तिथि
partial void AgeAtDiagnosis_Compute(ref int result)
{
// Set result to the desired field value
result = DateofDiagnosis.Year - DateofBirth.Year;
if (DateofBirth > DateofDiagnosis.AddYears(-result))
{
result--;
}
}
त्रुटि है:
'System.Nullable<System.DateTime>' does not contain a definition for 'Year' and no
extension method 'Year' accepting a first argument of
type 'System.Nullable<System.DateTime>' could be found (are you missing a using
directive or an assembly reference?)
यह असली दिनांक समय के साथ काम करता है? यदि ऐसा है तो आप गैर शून्य मान का उपयोग नहीं कर सकते हैं। ऐसा लगता है कि यह शून्य है साल की गणना की जरूरत नहीं है? – TGH
आपको Google https://www.google.co.in/search?q=nullable+datetime+in+c%23 खोजना चाहिए था – Prakash