Search
Project Description
This is a library of tools that I have developed and found them useful based on daily developments I have done. They are mostly extension methods. Also I have decided to experience functional programming in C#.
Chaeck out from: https://foop.svn.codeplex.com/svn/trunk/dev

Note: Check out last version as source code from https://foop.svn.codeplex.com/svn. This library has no dependencies.

After a year or so using this lab I have decided to polish it based on usefulness of each snippet in my daily developments. You can still access the source code for previous library at https://foop.svn.codeplex.com/svn/branches/freezed-1.

Update (May 24 2009): Tuples with 2-5 number of type parameters added. These tuples are value types and immutable (immutability is not granted for those objects that are used as arguments of tuple). There are also helper methods for creating tuples and extension method for binding tuple values simultaneously to multiple variables (something that can serve as multiple assignment).

Update (Jan 5 2010) Toolbox is a rearrangement of tools that provided in Foop. It is a separate project with same functionality but different structure and many new tools. I have renamed Foop to Toolbox in fact due to discussions with some friends, those are using this library. Many new tools added also like email sending facilities and a simple command line argument reader (not really a parser, yet handles -b:"C:\My Dir").

Experimental parts that was focused on functional programming removed because they were ugly (like pattern matching part) and Microsoft is releasing F#! I will implement tuples in a more imperative and simple approach; so they can be use more efficiently in a C# based environment (maybe by adding mutability!).

You can serialize and de-serialize objects to/from XML format using XmlSerialize and XmlDeserialize methods and there is less commonly used tools like DeepClone too.

Best of all I like the Pipe extension method. It makes it possible to build big expressions without a need to leave current context:

var query = 
    from sample in stream
    let description = sample.Pipe
    (
        s =>
        {
            Console.WriteLine(s.Rate);
            total -= s.Length;
            return s;
        }
    ).Pipe
    (
        s =>
        {
            s.Tag = GetProperTag();
            return s.Title + " / " + s.Tag;
        }
    )
    select new {sample, description};
//disclaimer: I do not recommend this kind of linq expressions.

This code is almost imaginary (well; in fact I HAVE write code like this and can be used as a bad practice for Pipe) but shows selling points of Pipe. Of course one could use ForEach for simpler scenarios.

There are some more experimental things like Curry.

Some other syntax helpers are:
1.To(10) -> IEnumerable<int>
20.May(2009) -> System.DateTime
JustDate and JustTime for System.DateTime

(As I have mentioned before things like Func and Action delegates with more than 5 arguments, tuples, Maybe, Either, Pattern Matching and other ideas from functional world removed because 1 - they seem ugly in C# (to my taste) 2 - I have used them rarely in my daily programming last year(which may change). Any comments are welcome.)
Last edited Jan 5 2010 at 10:41 AM by ksh2codeplex, version 9
Updating...
© 2006-2012 Microsoft | Get Help | Privacy Statement | Terms of Use | Code of Conduct | Advertise With Us | Version 2012.1.11.18365