=>
using System;
using System.Linq;
class MyClass
{
static void Main()
{
int n1, n2;
int[] ns = {22, 333, 4444, 9};
n1 = ns.Max(num => num);
n2 = ns.Min(num => num);
Console.WriteLine("{0}, {1}", n1, n2); //4444, 9
string[] ss = {"aaa", "bbbb", "ccccc", "dd"};
n1 = ss.Max(str => str.Length);
n2 = ss.Min(str => str.Length);
Console.WriteLine("{0}, {1}", n1, n2); //5, 2
Console.ReadKey();
}
}
& | ^ !
using System;
class MyClass
{
static void Main()
{
bool b;
b = true & true; Console.WriteLine(b); // True
b = true & false; Console.WriteLine(b); // False
b = false & false; Console.WriteLine(b); // False
b = true | true; Console.WriteLine(b); // True
b = true | false; Console.WriteLine(b); // True
b = false | false; Console.WriteLine(b); // False
b = true ^ true; Console.WriteLine(b); // False
b = true ^ false; Console.WriteLine(b); // True
b = false ^ false; Console.WriteLine(b); // False
b = !true; Console.WriteLine(b); // False
b = !false; Console.WriteLine(b); // True
Console.ReadKey();
}
}