VS2010小试

今天下了个VS2010VPC版本,小玩了一把!很恐怖的,解压出来将近25G,里面什么OfficeVS2008 SP1,TFS,Sharepoint,Sql Server2008应有尽有!唉,微软的速度太快了,程序员们都快跟不上了吧,现在估计还有好多人正在VS2005上写代码,都没有使用过VS2008

VS2008给我的第一感觉就是界面比以前的版本都要好看,感觉应该是使用了WPF技术了,废话少说了先上代码了!

 

ContractedBlock.gifExpandedBlockStart.gifCode
 1 using System;
 2 using System.Collections.Generic;
 3 using System.Linq;
 4 using System.Text;
 5 
 6 using Excel = Microsoft.Office.Interop.Excel;//引用COM组件
 7 using System.Diagnostics;
 8 namespace Demo01
 9 {
10     class Program
11     {
12         static void Main(string[] args)
13         {
14             //Dynamic sytax,可以在runtime时赋值,获知参数类型,和VS2008的var差不多
15             dynamic num1 = 5;
16             dynamic str1 = "Hello World";
17             Console.WriteLine(num1);
18             Console.WriteLine(str1);
19 
20             //Test optional arguments
21             TestOptionalMethod();//使用方法默认的参数值
22             TestOptionalMethod(510"IBM");//三个参数全部重新赋值
23             TestOptionalMethod(j: 5);//指定一个参数j
24 
25             //Excel
26             var excel = new Excel.Application();
27             excel.Visible = true;
28             excel.Workbooks.Add();
29             excel.Cells[11].Value = "Process Name";
30             excel.Cells[12].Value = "Memory Usage";
31             var process = Process.GetProcesses()
32                 .OrderBy(p => p.WorkingSet64)//此处有新的改进可以参照下面的图片
33                 .Take(20);
34 
35             int i = 2;
36             foreach (var p in process)
37             {
38                 excel.Cells[i, 1].Value = p.ProcessName;
39                 excel.Cells[i, 2].Value = p.WorkingSet64;
40                 i++;
41             }
42 
43             //excel.Cells[1, 1] = "ID";
44             //excel.Cells[1, 2] = "Number";
45             //int ii = 2;
46             //for (int j = 1; j < 5; j++)
47             //{
48             //    excel.Cells[ii, 1].Value = j;
49             //    excel.Cells[ii, 2].Value = j * 2;
50             //    ii++;
51             //}
52         }
53         static void TestOptionalMethod(int i = 1int j = 2string name = "Microsoft")
54         {
55             Console.WriteLine("The first number is :" + i);
56             Console.WriteLine("The second number is :" + j);
57             Console.WriteLine("The company name is :" + name);
58         }
59     }
60 }
61 

 

转载于:https://www.cnblogs.com/tengs2000/articles/1343088.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值