.Net Linq GroupBy anagram comparer example

using System;
using System.Collections.Generic;
using System.Linq;

namespace CsharpGroupByComparer
{
    class GroupByComparer
    {
        static void Main(string[] args)
        {
            var anagrams = new List<string> { "disks", "skids", "freed", "defer", "begin", "being", "note", "xxxx", };

            var results = anagrams.GroupBy(x => x.ToLower(), new AnagramComparer()).Where(x => x.Count() > 1).ToList();

            results.ForEach(Print);

            Console.ReadKey();
        }

        private static void Print(IGrouping<string, string> results)
        {
            foreach (var result in results)
                Console.WriteLine(result);
        }

        private class AnagramComparer : IEqualityComparer<string>
        {
            public bool Equals(string a, string b)
            {
                return GetString(a) == GetString(b);
            }

            public int GetHashCode(string obj)
            {
                return GetString(obj).GetHashCode();
            }

            private static string GetString(string word)
            {
                return new string(word.ToCharArray().OrderBy(x => x).ToArray());
            }
        }
    }
}

.Net Skip<> and Take<> example

using System;
using System.Collections.Generic;
using System.Linq;

namespace CsharpSkipTakeExample
{
    static class SkipTakeDemo
    {
        static void Main(string[] args)
        {
            var months = new List<string>
                           {
                               "January",
                               "February",
                               "March",
                               "April",
                               "May",
                               "June",
                               "July",
                               "August",
                               "September",
                               "October",
                               "November",
                               "December"
                           };

            // Get the first 6 months
            var firstSixMonths = months.GetRange(0, 6);

            firstSixMonths.ForEach(Print);

            Console.WriteLine();

            // Take the first 3 months
            var firstThreeMonths = months.Take(3).ToList();

            firstThreeMonths.ForEach(Print);

            Console.WriteLine();

            // Months ending with y
            var monthsEndingWithY = months.TakeWhile(x => x.EndsWith("y")).ToList();

            monthsEndingWithY.ForEach(Print);

            Console.WriteLine();

            // Skip the first Month by condition
            var skipTheFirstMonth = months.SkipWhile(x => x.StartsWith("J")).ToList();

            skipTheFirstMonth.ForEach(Print);

            Console.ReadKey();
        }

        private static void Print(string input)
        {
            Console.WriteLine(input);
        }
    }
}

.Net List<>.TrueForAll example

using System;
using System.Collections.Generic;

namespace CsharpTrueForAll
{
    public static class TrueForAllDemo
    {
        public static void Main()
        {
            var countries = new List<string> {"England", "Scotland", "Ireland", "Wales"};

            Console.WriteLine(countries.TrueForAll(CheckEnding));

            Console.ReadKey();
        }

        private static bool CheckEnding(string input)
        {
            return input.ToLower().EndsWith("land");
        }
    }
}