Simple and fast solution to count total months between 2 dates.If you want to get only different months, not counting the one that is in From date - just remove +1 from code.
public static int GetTotalMonths(DateTime From, DateTime Till) { int MonthDiff = 0; for (int i = 0; i < 12; i++) { if (From.AddMonths(i).Month == Till.Month) { MonthDiff = i + 1; break; } } return MonthDiff; }