lamp

April 2009 - Posts

Did you know F# ?
30 April 09 08:47 AM | Frederick.Chapleau | with no comments

I found a great article comparing C# and F#… thanks to Brian McNamara.

-f.

Filed under:
Implementing an Extension to Sort ControlCollection in .NET 3.5
24 April 09 11:50 AM | Frederick.Chapleau | 1 comment(s)

public static class SortingExtension
{
    public static void Sort<T>(this System.Windows.Forms.Control.ControlCollection c) where T : class
    {
        for(int i=1; i<c.Count; i++)
        {
            IComparable<T> ctl = cIdea as IComparable<T>;
            T pCtl = c[i - 1] as T;

            if (ctl != null && pCtl != null)
                if (ctl.CompareTo(pCtl) > 0)
                    c.SetChildIndex(cIdea, c.GetChildIndex(cIdea) - 1);
        }
    }
}

 

I will detailed a little more later this implementation.

-f.

Filed under: