http://topic.csdn.net/u/20110610/13/d1924231-0a45-4826-ac2a-7bbcfcb9fc93.html
上面是你的帖子,学习了。。
 但是我不会Lambda表达式,而且我的是vs2003.
求解那个委托怎么正常的写出来?SetAlgorithms.CartesianProduct(new int[] { c1.Length, c2.Length, c3.Length }, (result, len) =>
            {
                Console.WriteLine("{0},{1},{2}", c1[result[0]], c2[result[1]], c3[result[2]]);
                return true;
            });

(result, len) =>
            {
                Console.WriteLine("{0},{1},{2}", c1[result[0]], c2[result[1]], c3[result[2]]);
这个怎么正常写出来,在不支持Lambda表达式的情况下?
  顺便求大神指导下Lambda表达式怎么理解?

解决方案 »

  1.   

    delegate (int[] result, int len)
    {
        Console.WriteLine("{0},{1},{2}", c1[result[0]], c2[result[1]], c3[result[2]]);
    }
      

  2.   


    using System;namespace Rabbit.Tools
    {
    /// <summary>
    /// Test测试笛卡尔积算发
    /// </summary>
    class Test
    {
    /// <summary>
    /// 应用程序的主入口点。
    /// </summary>
    [STAThread]
    static void Main(string[] args)
    {
    string c1 = new string[] {"帽子1","帽子2","帽子3"};
    string c2 = new string[] { "上衣1", "上衣2", "上衣3" };
    string c3 = new string[] { "裤子a", "裤子b" };
    //Lambda表达式,目前不支持
    // SetAlgorithms.CartesianProduct(new int[] { c1.Length, c2.Length, c3.Length }, (result, len) =>
    // {
    // Console.WriteLine("{0},{1},{2}", c1[result[0]], c2[result[1]], c3[result[2]]);
    // return true;
    // }); }
    }
    }上面的是我的测试代码,估计很乱。  能否帮我测试一下,环境是vs2003。
      

  3.   

    还有个问题,vs2003好像不支持静态方法?public static class SetAlgorithms
    {
    /// <summary>
    /// 集合算法的回调
    /// </summary>其中SetAlgorithms
    老是报错。
      

  4.   

    VS2003啊VS2003连匿名委托都不支持调用
    int[] array = new int[] { c1.Length, c2.Length, c3.Length };SetAlgorithms.CartesianProduct(array, new SetAlgorithmCallback(CallBack));加一个方法
    private void CallBack(int[] result, int len)
    {
        Console.WriteLine("{0},{1},{2}", c1[result[0]], c2[result[1]], c3[result[2]]);
    }
      

  5.   

    静态方法支持的但是不支持静态类。也就是给 class 修饰 static。
      

  6.   

    上面的是类。  敲字敲快了,没注意。  静态方法支持的但是不支持静态类
    希望不要误导新手了。  另外Lambda你是怎么理解的啊?虽然知道过程了。
      自己在手动写还是有点不会。