Using system;
Using system. Collections. Generic;
Using system. LINQ;
Using system. text;
Using system. collections;
Namespace fluentinterfacedemo
{
Class Program
{
Static void main (string [] ARGs)
{
Fluent fluent = new fluent ();
Fluent. Money = 10000;
Console. writeline (fluent. ispass (F => F. Money ));
Console. writeline (fluent. calctax (F => F. Money). Money );
Console. writeline (GetType <fluent> (fluent ));
Console. Read ();
}
Static string GetType <tsource> (tsource T)
{
Return T. GetType (). tostring ();
}
}
Class fluent: ifluent
{
Public int userid {Get; set ;}
Public string name {Get; set ;}
Public double money {Get; set ;}
}
Static class fluentextent
{
Public static bool ispass (this ifluent fluent, func <fluent, double> func)
{
Double M = func (fluent );
Return double. parse (M. tostring ()> 0;
}
Public static fluent calctax (this fluent, func <fluent, double> func)
{
Fluent. Money = func (fluent) * 0.35;
Return fluent;
}
}
Class tax
{
Public double money {Get; set ;}
Public static double gettax ()
{
Return 100;
}
}
Interface ifluent
{
}
}