Func
Func
<dataType>
means a method that returns a dataType.Func
<Date>
means a method that returnDate
Func
<Number>
means a method that returnNumber
Func
<Time>
means a method that returnTime
Func
<Text>
means a method that returnText
Func
<Bool>
means a method that returnBool
Bind the value of the
DaysBetween
Column, Use Visual Studio's "Generate Method" factoring to create it.
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