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

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).

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 May 24 at 9:27 AM by ksh2codeplex, version 7

 

Want to leave feedback?
Please use Discussions or Reviews instead.

Updating...
© 2006-2009 Microsoft | About CodePlex | Privacy Statement | Terms of Use | Code of Conduct | Version 2009.6.1.15196