GithubHelp home page GithubHelp logo

pragmatrix / fluent.extensions Goto Github PK

View Code? Open in Web Editor NEW
3.0 3.0 0.0 22 KB

Fluent.Extensions is a portable class library that implements extensions methods for collections and more

C# 89.46% Makefile 10.54%

fluent.extensions's Introduction

Fluent.Extensions

Fluent.Extensions is a netstandard class library that supports programming against fluent interfaces. Its primary purpose is to ease the transition to a more fluent programming style as part of every AutoFluent package.

Installation

Fluent.Extensions can be installed separately via NuGet.

Contents

Generic collections extension methods

Fluent.Extensions contains all extension methods defined in the Collections.Fluent project that are used to modify generic collections inside a method chain. They are available as soon the namespace System.Collections.Generic is used.

General purpose methods

The following general purpose extension methods are defined in the global namespace, they are available as soon Fluent.Extensions is referenced by your project.

Do()

The Do() extension method can be inserted inside a method chain to call back into lambda expression or a method. The lambda expression is expected to have exactly one parameter that receives the current object of the method chain. Do() always returns the current object.

For example:

var x = 10;
1.Do(v => x += v)
 .Do(v => x += v*2);

Sets x to 13.

Pipe()

The Pipe(f) extension calls the function f with the current object of the method chain and continues with the function's result.

For example:

var x = 10.Pipe(a => a * a);

Sets x to 100.

AutoFluent specific extension methods

These are extension methods used by AutoFluent generated packages.

DemoteSender()

The DemoteSender() extension method forwards a call to an Action<> delegate with the first parameter set to the object type to an Action<> delegate with the concrete type of a class by casting the first argument. This is used to provide an event's sender as a concrete instance type to client code that handles the event. Instead of code generating each forwarding lambda, AutoFluent uses DemoteSender() to reduce the code size of the resulting AutoFluent class library.

License & Copyright

License: BSD

Copyright © 2016 Armin Sander

fluent.extensions's People

Contributors

pragmatrix avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.