Skip to content
Fluent API for the .NET Framework (used by the O2 Platform)
Find file
Latest commit ee25922 @DinisCruz DinisCruz Merge pull request #58 from alexandrustanimir/master
Fixing appveyor build #57
Failed to load latest commit information.
Docs Adding Images for main ReadMe
FluentSharp.AST Pushing 5.5 code changes
FluentSharp.AspNet_MVC Updated Soloution file,
FluentSharp.CoreLib appveyor experiments
FluentSharp.HtmlAgilityPack.WinForms Pushing 5.5 code changes
FluentSharp.HtmlAgilityPack Number of NuGet fixes
FluentSharp.Moq Small fix on Moq.nuspec
FluentSharp.MsBuild number of NuSpec fixes
FluentSharp.NGit Multiple refactorings on FluentSharp.CoreLib (namely on AppDomain Ext…
FluentSharp.NUnit Minor fix
FluentSharp.O2Platform Pushing 5.5 code changes
FluentSharp.REPL Minor change
FluentSharp.Roslyn Misc changes:
FluentSharp.WPF Updating version to 5.5
FluentSharp.Web Couple ExtensionMethods fixes
FluentSharp.Web_4_5 Misc changes:
FluentSharp.WinForms Pushing 5.5 code changes
FluentSharp.WinFormsUI Couple new FluentSharp.NUnit tests
FluentSharp.Xml Number of NuGet fixes
FluentSharp.Zip Moved zip method and classes into this new FluentSharp.Zip project
FluentSharp_Fork.CassiniDev @ 882eaa0 updating submodule ref
FluentSharp_Fork.SharpDevelopEditor @ 70cd79d updating submodules references
FluentSharp_Fork.WatiN @ 131b026 updating commit xref
UnitTests unused references
_vsSolutions Fixed NuGet API to support mono execution
packages First commit after compiling ok on OS X (mono 3.1), with unit tests r…
.gitignore First commit after compiling ok on OS X (mono 3.1), with unit tests r…
.gitmodules Updating submodules to use the URL
.travis.yml First commit after compiling ok on OS X (mono 3.1), with unit tests r…
FluentSharp.sln Multiple refactorings on FluentSharp.CoreLib (namely on AppDomain Ext… adding travis build status image
TmpKey.snk major refactoring and new VisualStudio 2010 Extension

FluentSharp Build Status

FluentSharp are a number of Open Source .Net APIs that dramatically simplifies the use of .NET Framework APIs.

They makes extensive use of .NET ExtensionMethods and reduces the amount of code required (while making the original code more readable).

By now, a large part of the .NET Framework is covered by FluentSharp ExtensionMethods (String, Xml, IO, WinForms, Reflection, etc..).

As an example, the FluentSharp .NET Reflection ExtensionMethods are very powerful, since they provide (via user-friendly methods) full access to .NET classes, methods, properties, fields and enums (regardless of their public/private status).

How to clone and compile FluentSharp in VisualStudio 2013

What is the OWASP O2 Platform

The FluentSharp APIs are at the core of the OWASP O2 Platform which is usually described like this: 'The O2 platform represents a new paradigm for how to perform, document and distribute Web Application security reviews. O2 is designed to Automate Security Consultants Knowledge and Workflows and to Allow non-security experts to access and consume Security Knowledge'


You can get all FluentSharp APIs via Nuget. For example FluentSharp.WatiN can be installed by typing this command in the VisualStudio Package Manager Console Install-Package FluentSharp.WatiN

Here are the main packages:

Full list of published Nuget packages is here

Code Samples

Here is where you can find tons of code samples and O2 releated posts


Mailing list and issues list

If you want to ask questions about the O2 Platform or FluetnSHarp please use the!forum/o2-platform.

If you want to open an issue or want to help, please take a look at the issues currently opened and see if you can provide a fix for them:

FluentSharp in Action: Example 1

For example if you want to list all files from a particular directory you can just execute:


...if you wanted all files in all directories (i.e. recursive search), you would use:


... all *.cs files:


... all *.cs and *.h2 files:

@"C:\O2".files(true,"*.cs" ,"*.h2");

... show files in treeView:

new TreeView().add_Nodes(@"C:\O2".files(true,"*.cs","*.h2")); results in a popupWindow (i.e. in Windows Form) with treeView showing files:

"New popup Window with TreeView".popupWindow().add_TreeView().add_Nodes(@"C:\O2".files(true,"*.cs","*.h2"));

... swow in popupWindow with the TreeVIew with files and a source code viewer that shows the selected file:

var targetFolder = @"C:\O2";
var sourceCodeViewer ="View C# and H2 files in folder".popupWindow()
        .add_Nodes(targetFolder.files(true,"*.cs","*.h2"), (file)=>file.fileName())

The key objective of this style of programming is to make it really easy read and understand what is going on.

The way these extension methods are written is to focus on the Intent of the action, and then hide all technology behind the scenes.

For example in the last example, this code

.add_TreeView().add_Nodes(targetFolder ,"*.cs","*.h2"), (file)=>file.fileName());

can be further refactored to:

.add_TreeView().add_Files(targetFolder ,"*.cs","*.h2");

FluentSharp in Action: Example 2

Here is a more complete example that shows these FluentSharp APIs in action (inside VisualStudio):

using System;
using System.Linq;
using System.Text;
using System.Drawing;
using System.Windows.Forms;
using System.Collections.Generic;
using FluentSharp.O2.Views.ASCX.classes.MainGUI;
using FluentSharp.O2.Kernel.ExtensionMethods;
using FluentSharp.O2.DotNetWrappers.ExtensionMethods;

namespace FluentSharp_Test
    class Program
        static void Main(string[] args)
            var topPanel =<Panel>("FluentSharp - Simple Test", 1000, 300);            

            //TextBox that will hold the data
            var textBox = topPanel.add_GroupBox("TextBox with selected data").add_TextArea();

            //Left-Hand-side TreeView with filenames (when click shows content on TextBox)
            var folder = @"C:\O2\Demos\FluentSharp";
                   .add_GroupBox("Files in Folder")
                   .add_Nodes(folder.files("*.cs", true))
                   .afterSelect<string>((file) => textBox.set_Text(file.fileContents()))

            //Right-Hand-side TreeView with types from an Assembly (when click shows list of methods on TextBox)
            var assemblyToShow = "FluentSharp_O2.dll";
                   .add_GroupBox("Types in Assembly")
                   .afterSelect<Type>((type) =>
                            textBox.set_Text("Methods in Type: {0}".line().format(type.fullName()));
                            foreach (var method in type.methods())
                                textBox.append_Line("  -  {0}".format(method.Name));                     

The code above when executed will look like this:

Here is an example of how to use the FluentSharp REPL (also part of the O2 Development Environment) to develop and quickly execute the script above:

GitHub Repositories

There a number of GitHub repositories used to host the multiple parts of the FluentSharp and O2 Platform components:

There is also the which contains the first pass at creating an book about the O2 Platform and WatiN APIs

Why Fluent?

Rational and References for Fluent Interfaces, Fluent Programming

The O2 Platform scripting environment makes extensive use of C# 3.0 features like Linq, Lambda and ExtensionMethods. Here is a great article that explains how these technologies work and provide C# code samples of how to use them: . Some of these already have their representation in O2, for exampe the 'Where' function has an equivalent lowercase 'where' ExtensionMethod , with the O2 version handling the checking if the original data is null, and returning a List (instead of an Enumerable)

I found the 'Fluent' concept when I was looking at JQuery and noticed that its API (Philosophy) looked a lot like O2's API.

JQuery calls what it does 'Fluent API' and I had a look at what it means and found what I'm doing with O2's Scripting is a lot like it. Here are some references for past 'Fluent' threads:

What is interesting about the links above is that:

a) they are a bit old (circa 2008) and b) they don't mention .Net's extension methods (which for me are the KEY reason why I went the 'fluent way' in O2's API). The other thing that I do very differently in O2, is that I don't create special 'Fluent Interface' classes, I just extend the ones that already exist.

Something went wrong with that request. Please try again.