using
System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;
namespace Fanxing
{
class Program
{
public delegate bool del( int x);
static void Main( string [] args)
{
IList < Int32 > i = new List < int > { 44 , 33 , 55 };
List < Int32 > j = new List < int > { 5 , 2 , 3 };
// j.Add(9);
j.Sort( new Comparison < int > ( new hehe().Result));
j.AddRange( new Int32[] { 11 , 22 , 33 }); // AddRange是指一个可以枚举的集合
j.Where(( int q) => { return q > 3 ; }); // 没搞清楚
int num = j.Find(( int p) => { return p == 3 ; });
// Console.WriteLine(num);
Console.WriteLine( " List.Find方法(参数委托类型) " );
Console.WriteLine(j.Find( delegate ( int x) { return x > 2 ; }));
Console.WriteLine( " List.FindAll方法(参数委托类型) " );
Console.WriteLine((j.FindAll( delegate ( int x) { return x > 2 ; }))[ 0 ]);
Console.WriteLine( " List.Find方法(参数是另外定义的方法) " );
Console.WriteLine(j.Find( new hehe().show));
Console.WriteLine( " List.Find方法(参数是兰姆达表达式) " );
Console.WriteLine(j.Find(( int x) => { return x > 3 && x < 5 ; }));
Console.WriteLine((j.Where(( int x) => { return x > 3 && x < 8 ; }))); // 如果条件不止一个,该怎么写
// Console.WriteLine("{0},{1},{2},{3}", j[0], j[1], j[2], j[3]);
Type t = j.GetType();
List < test > c = new List < test > ();
c.Add( new tson());
c.Sort();
// Console.Write(c[0].GetType());
Console.ReadLine();
}
}
public class test
{
}
public class tson : test
{
}
public class hehe
{
public int Result( int x, int y)
{
if (x > y)
return 0 ;
else
return 1 ;
}
public bool Get( int x)
{
x = 22 ;
return true ;
}
public bool show( int x)
{
if (x > 3 )
return true ;
else
return false ;
}
}
}
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;
namespace Fanxing
{
class Program
{
public delegate bool del( int x);
static void Main( string [] args)
{
IList < Int32 > i = new List < int > { 44 , 33 , 55 };
List < Int32 > j = new List < int > { 5 , 2 , 3 };
// j.Add(9);
j.Sort( new Comparison < int > ( new hehe().Result));
j.AddRange( new Int32[] { 11 , 22 , 33 }); // AddRange是指一个可以枚举的集合
j.Where(( int q) => { return q > 3 ; }); // 没搞清楚
int num = j.Find(( int p) => { return p == 3 ; });
// Console.WriteLine(num);
Console.WriteLine( " List.Find方法(参数委托类型) " );
Console.WriteLine(j.Find( delegate ( int x) { return x > 2 ; }));
Console.WriteLine( " List.FindAll方法(参数委托类型) " );
Console.WriteLine((j.FindAll( delegate ( int x) { return x > 2 ; }))[ 0 ]);
Console.WriteLine( " List.Find方法(参数是另外定义的方法) " );
Console.WriteLine(j.Find( new hehe().show));
Console.WriteLine( " List.Find方法(参数是兰姆达表达式) " );
Console.WriteLine(j.Find(( int x) => { return x > 3 && x < 5 ; }));
Console.WriteLine((j.Where(( int x) => { return x > 3 && x < 8 ; }))); // 如果条件不止一个,该怎么写
// Console.WriteLine("{0},{1},{2},{3}", j[0], j[1], j[2], j[3]);
Type t = j.GetType();
List < test > c = new List < test > ();
c.Add( new tson());
c.Sort();
// Console.Write(c[0].GetType());
Console.ReadLine();
}
}
public class test
{
}
public class tson : test
{
}
public class hehe
{
public int Result( int x, int y)
{
if (x > y)
return 0 ;
else
return 1 ;
}
public bool Get( int x)
{
x = 22 ;
return true ;
}
public bool show( int x)
{
if (x > 3 )
return true ;
else
return false ;
}
}
}