Fluentinterfacedemo draft or note

Source: Internet
Author: User

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
{

}
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.