文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>光脚丫学LINQ(011):对源元素执行操作

光脚丫学LINQ(011):对源元素执行操作

时间:2010-10-29  来源:光脚丫思考

// Data source.   
double[] Radii = { 1, 2, 3, 4, 5, 6, 7, 8, 9 };   
  
// Results.   
IEnumerable<string> Results =   
    from Rad in Radii   
    select String.Format("Area = {0}", (Rad * Rad) * 3.14);   
  
// Results execution.    
foreach (string Result in Results)   
    Console.WriteLine(Result);   
  
// Keep the console open in debug mode.   
Console.WriteLine("Press any key to exit.");   
Console.ReadKey()  
// Data source.
double[] Radii = { 1, 2, 3, 4, 5, 6, 7, 8, 9 };

// Results.
IEnumerable<string> Results =
    from Rad in Radii
    select String.Format("Area = {0}", (Rad * Rad) * 3.14);

// Results execution. 
foreach (string Result in Results)
    Console.WriteLine(Result);

// Keep the console open in debug mode.
Console.WriteLine("Press any key to exit.");
Console.ReadKey() 


输出如下:

Area = 3.14   
Area = 12.56   
Area = 28.26   
Area = 50.24   
Area = 78.5   
Area = 113.04   
Area = 153.86   
Area = 200.96   
Area = 254.34 
相关阅读 更多 +
排行榜 更多 +
辰域智控app

辰域智控app

系统工具 下载
网医联盟app

网医联盟app

运动健身 下载
汇丰汇选App

汇丰汇选App

金融理财 下载