Example: Days - Settlement Date to Next Coupon Date

In this example, the settlement date is 11/11/86. The number of days from this date to the next coupon date is returned.
using System;
using Imsl.Finance;

public class coupdaysncEx1
{
    public static void  Main(String[] args)
    {
        DateTime settlement = DateTime.Parse("11/11/86");
        DateTime maturity = DateTime.Parse("3/1/99");
        Bond.Frequency freq = Bond.Frequency.SemiAnnual;
        DayCountBasis dcb = DayCountBasis.BasisActual365;
        int coupdaysnc = Bond.Coupdaysnc(settlement, maturity, freq,
                                         dcb);
        Console.Out.WriteLine("The number of days from the settlement date "
                              + "to the next coupon date is " + coupdaysnc);
    }
}

Output

The number of days from the settlement date to the next coupon date is 110

Link to C# source.