Retourner au contenu associé (dépêche : Mono 2.0 : le singe continue ses grimaces)
Posté par TImaniac (site web personnel) le 14 octobre 2008 à 16:20. En réponse à la dépêche Mono 2.0 : le singe continue ses grimaces. Évalué à 2.
AltStyle によって変換されたページ (->オリジナル) / アドレス: モード: デフォルト 音声ブラウザ ルビ付き 配色反転 文字拡大 モバイル
[^] # Re: Intérèt de mono et .Net
Posté par TImaniac (site web personnel) . En réponse à la dépêche Mono 2.0 : le singe continue ses grimaces. Évalué à 2.
using System;
using System.IO;
public static class LinuxFrTrollExtensions
{
public static void times(this int nb, Action action)
{
for (int i = 0; i < nb; i++)
action();
}
public static string pluralize(this string text)
{
return "people";//devrait parcourir un dictionnaire ici
}
public static TimeSpan hour(this int h)
{
return TimeSpan.FromHours(h);
}
public static TimeSpan minutes(this int m)
{
return TimeSpan.FromMinutes(m);
}
}
class Program
{
static void print(object o)
{
Console.WriteLine(o);
}
static void Main(string[] args)
{
2.times(() => print("toto"));
print("person".pluralize());
print(DateTime.Now + 1.hour() + 5.minutes());
Console.ReadLine();
}
}