System.Globalization.PersianCalendar.AddYears Method

Returns a DateTime object that is offset the specified number of years from the specified DateTime object.

Syntax

public override DateTime AddYears (DateTime time, int years)

Parameters

time
The DateTime to which to add years.
years
The positive or negative number of years to add.

Returns

The DateTime object that results from adding the specified number of years to the specified DateTime object.

Remarks

The DateTime.Kind property of the returned DateTime value always equals DateTimeKind.Unspecified. You can preserve the DateTime.Kind property of the time parameter by calling the DateTime.SpecifyKind(DateTime, DateTimeKind) method, as the following example shows.

code reference: System.Globalization.Calendar.AddMethods#8

Requirements

Namespace: System.Globalization
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 2.0.0.0, 4.0.0.0
Since: .NET 2.0