标题: xml linq简单使用 [打印本页] 作者: 孟庆波 时间: 2012-5-6 19:58 标题: xml linq简单使用 using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Linq;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
#region;
//string[] names = { "Burke", "Connor", "Frank", "Everett", "Albert", "George", "Harris", "David" };
//IEnumerable<string> expr = from s in names
// where s.Length == 5
// orderby s
// select s.ToUpper();
//foreach (string item in expr)
//{
// this.listView1.Items.Add(item);
//}
//Func<int, int, int> add = (int x, int y) => x * y;
//Console.WriteLine(add(6, 4));
//Console.ReadKey();
//显示转化为隐式
//(int x, int y) => x * y;
//(x, y) => x * y;
// =>左边为参数,右边为表达式
#endregion;
#region;
//var words = new string[] { "中国", "英国", "法国", "中国人" };
//IEnumerable<string> hasDAndE =
// from s in words
// where s.Contains('中') && s.Contains('国')
// select s.Trim();
//var words = new string[] { "中国", "英国", "法国", "中国人" };
//IEnumerable<string> hasDAndE =
//words.Where(s => s.Contains('中') && s.Contains('国'));
//foreach (string s in hasDAndE)
//{
// Console.WriteLine(s);
//}
//结果为:中国人,中国