Example #1
0
        public static void MapTwo()
        {
            // define a list of names
            List <string> names = new List <string>(
                new string[] { "Aurelie", "Fabrice",
                               "Ibrahima", "Lionel" });
            // call the F# demo  function in an
            // anonymous delegate
            List <string> results =
                FuncsTakesFuncs.filterStringListDelegate(
                    delegate(string s) { return(s.StartsWith("A")); }, names);

            // write the results to the console
            foreach (var s in results)
            {
                Console.WriteLine(s);
            }
        }
Example #2
0
        public static void MapOne()
        {
            // define a list of names
            List <string> names = new List <string>(
                new string[] { "Stefany", "Oussama", "Sebastien", "Frederick" }
                );
            // define a predicate delegate/function
            Converter <string, bool> pred =
                delegate(string s) { return(s.StartsWith("S")); };

            // convert to a FastFunc
            FSharpFunc <string, bool> ff =
                FuncConvert.ToFSharpFunc <string, bool>(pred);
            // call the F# demo function
            IEnumerable <string> results = FuncsTakesFuncs.filterStringList(ff, names);

            // write the results to the console
            foreach (var name in results)
            {
                Console.WriteLine(name);
            }
        }