复习以前学过的东西 发现大部分东西都忘记了。悲剧。后来总结发现应该记个记号,以后没事的时候翻出来瞅两眼,忘的就不是那么快了。那都是必须的。

   摘至MSDN :Lambda

 

x => x * x 读作“x goes to x times x”。可以将此表达式分配给委托类型.

 

=) 相同的优先级,并且是右结合运算符。

lambda=>Msdn.lambdaInfo.

 

  1、建立一个MVC工程.

Lambda,MVC 练习(20101117)

 2、建立以个文件夹并命名为components与Views文件夹同级.

    其次在components下建立类Mycompares其代码如下:

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

namespace LambdaMvcPractice.Components
{
    
public class Mycompare : IComparer<int>
    {
        
public int Compare(int x, int y)
        {
            
int x1 = Math.Abs(x);
            
int y1 = Math.Abs(y);
            
if (x1 > y1)
            {
                
return 1;
            }
            
else if (x1 == y1)
            {
                
return 0;
            }
            
else
            {
                
return -1;
            }
        }
    }
}

相关文章: