Func

  • Func<dataType> means a method that returns a dataType.

  • Func<Date> means a method that return Date

  • Func<Number> means a method that return Number

  • Func<Time> means a method that return Time

  • Func<Text> means a method that return Text

  • Func<Bool> means a method that return Bool

  • see Func Power Point Presentation

  • Bind the value of the DaysBetween Column, Use Visual Studio's "Generate Method" factoring to create it.
    2017 02 26 10H41 42

public class DemoLocalColumns : UIControllerBase
{
    public readonly DateColumn FromDate = new DateColumn("From Date");
    public readonly DateColumn ToDate = new DateColumn("To Date");
    public readonly NumberColumn DaysBetween = new NumberColumn("Days Between","5CN");

    public DemoLocalColumns()
    {
        ToDate.BindValue(GetEndOfMonthOfFromDate);
        DaysBetween.BindValue(GetDaysBetween);
    }
    public Number GetDaysBetween()
    {
        return ToDate - FromDate;
    }
    public Date GetEndOfMonthOfFromDate()
    {
        return FromDate.EndOfMonth;
    }
  ...
} 

Use C#6 style methods to write shorter code

public class DemoLocalColumns : UIControllerBase
{
    public readonly DateColumn FromDate = new DateColumn("From Date");
    public readonly DateColumn ToDate = new DateColumn("To Date");
    public readonly NumberColumn DaysBetween = new NumberColumn("Days Between","5CN");

    public DemoLocalColumns()
    {
        ToDate.BindValue(GetEndOfMonthOfFromDate);
        DaysBetween.BindValue(GetDaysBetween);
    }
    public Number GetDaysBetween() => ToDate - FromDate;

    public Date GetEndOfMonthOfFromDate() => FromDate.EndOfMonth;
  ...
} 

For a deeper discussion of these topics see Lambda Expressions Generics and BindValue


Help us improve, Edit this page on GitHub
or email us at info@fireflymigration.com