<#@ template language="C#" debug="true" hostSpecific="true" #> <#@ Assembly Name="System.Core.dll" #> <#@ import namespace="System" #> <#@ import namespace="System.Text" #> <#@ import namespace="System.Linq" #> <#@ import namespace="System.Collections.Generic" #> <#@ import namespace="System.Globalization" #> <#@ output extension=".cs" #> // Attention : ce fichier a été automatiquement généré par un // template T4. Toute modification manuelle sera écrasée !!! using System; namespace Developpez.Dotnet { public partial class DateExtensions { <# var invariant = DateTimeFormatInfo.InvariantInfo; var french = CultureInfo.GetCultureInfo("fr-FR").DateTimeFormat; var months = from m in Enumerable.Range(1, 12) select new { Number = m, InvariantName = invariant.MonthNames[m - 1], FrenchName = french.MonthNames[m - 1] }; foreach (var m in months) { #> /// /// Renvoie une date correspondant au jour spécifié du mois de <#= m.FrenchName #> de l'année spécifiée. /// /// Jour /// Année /// La date correspondant au jour spécifié du mois de <#= m.FrenchName #> de l'année spécifiée. public static DateTime <#= m.InvariantName #>(this int day, int year) { return new DateTime(year, <#= m.Number #>, day); } <# } #> } }