在c#中的一个类中的另一个委托函数中调用委托函数

时间:2017-05-07 12:42:44

标签: c# delegates

我在一个类中写了一些委托函数,如下所示

  public Func<string, DateTime> toGeorgianDate = persianDatestr =>
    {
        string[] persianDateParts = persianDatestr.Split(new char[] { '/', ':', ' ' });
        int persianYear = int.Parse(persianDateParts[0]);
        int persianMonth = int.Parse(persianDateParts[1]);
        int persianDay = int.Parse(persianDateParts[2]);
        int persianHour = int.Parse(persianDateParts[3]);
        int persianMinute = int.Parse(persianDateParts[4]);
        int persianSecond = int.Parse(persianDateParts[5]);
        PersianCalendar pc = new PersianCalendar();
        DateTime GeorgianDate = new DateTime(persianYear, persianMonth, persianDay,persianHour,persianMinute,persianSecond,pc);
        return GeorgianDate;
    };

我想在下面的函数中调用GeorgianDate,我怎么称它为?

    public Func<DateTime, int> PersianYear = GeorgianDateTime =>
       {

           return ;
       };

0 个答案:

没有答案