唉。。装个vs要7.5G,装个游戏要8G看来我也要去买 1T的硬盘了。。听说1T的硬盘现在也不是很贵
解决方案 »
- 从数据库提了60000条数据.DataSet只装载了30692条..怎么回事?
- 100分问下怎么获取textbox里面指定的内容
- C#中对于object[,]类型的数据如何提取最大下标?
- 【请问】C# 如何实现datagridview显示中只显示指定的有效位数,同时不丢失信息
- GoldPrinter.ExcelExpert.ExcelBase
- 谁有时间帮助我下, ~!!分分分!!!菜鸟求助大家,刚刚学习的
- 拖拽层怎样保存DIV状态到数据库中?
- 高分求救!网页播放器,播放地址问题!
- NHibernate分页问题
- 高分求助,不够还可以增加!!!
- windows mobile 下,如何使系统发声?声音文件!
- 如何在C#中使用API(WritePrivateProfileString)向UTF-8的Ini文件中写入正确的值
75 GB还是7.5 GB?
最小:
75G HDD !!应该写错了
2G RAM
2GHZ 双核处理器
2008还没有完全玩通,2010就来了。
MS花大手笔在这开发工具上,弄得开发工具越来越庞大,倒还不如投点资到基于.NET的应用框架与解决方案的支持上。比如,WCF确实不错,但庞大的WCF体系与繁杂的配置,也使得WCF在市场上的应用变得不那么讨人喜欢。MS倒可以针对这些新的技术做些解决方案。
* The host computer must have a minimum of 2 GB RAM, with 1 GB allocated to the host operating system and 1 GB allocated to the VPC.
* We recommend that the host computer CPU be at least a Core Duo 2 GHz processor.
* Service Pack 1 of Microsoft Virtual PC 2007 is required to access the VPC. --------------------------我靠!这样下来升级都没有升!只能重新弄个了!最少得5000块吧!
C#4.0加入了dynamic关键字,可以申明一个变量的static类型为dynamic(有点绕口)。在3.0及之前,如果你不知道一个变量的类型,而要去调用它的一个方法,一般会用到反射:object calc = GetCalculator();
Type calcType = calc.GetType();
object res = calcType.InvokeMember("Add",
BindingFlags.InvokeMethod, null,
new object[] { 10, 20 });
int sum = Convert.ToInt32(res);
有了dynamic,就可以把上面代码简化为:dynamic calc = GetCalculator();
int sum = calc.Add(10, 20);
使用dynamic的好处在于,可以不去关心对象是来源于COM, IronPython, HTML DOM或者反射,只要知道有什么方法可以调用就可以了,剩下的工作可以留给runtime。下面是调用IronPython类的例子:ScriptRuntime py = Python.CreateRuntime();
dynamic helloworld = py.UseFile("helloworld.py");
Console.WriteLine("helloworld.py loaded!"); dynamic也可以用在变量的传递中,runtime会自动选择一个最匹配的overload方法。
这里有一个demo:把一段javascript代码拷到C#文件中,将var改成dynamic,function改成void,再改一下构造函数的调用方式(new type()改为win.New.type()),去掉javascript中的win.前缀(因为这已经是C#的方法了),就可以直接运行了。dynamic的实现是基于IDynamicObject接口和DynamicObject抽象类。而动态方法、属性的调用都被转为了GetMember、Invoke等方法的调用。public abstract class DynamicObject : IDynamicObject
{
public virtual object GetMember(GetMemberBinder info);
public virtual object SetMember(SetMemberBinder info, object value);
public virtual object DeleteMember(DeleteMemberBinder info); public virtual object UnaryOperation(UnaryOperationBinder info);
public virtual object BinaryOperation(BinaryOperationBinder info, object arg);
public virtual object Convert(ConvertBinder info); public virtual object Invoke(InvokeBinder info, object[] args);
public virtual object InvokeMember(InvokeMemberBinder info, object[] args);
public virtual object CreateInstance(CreateInstanceBinder info, object[] args); public virtual object GetIndex(GetIndexBinder info, object[] indices);
public virtual object SetIndex(SetIndexBinder info, object[] indices, object value);
public virtual object DeleteIndex(DeleteIndexBinder info, object[] indices); public MetaObject IDynamicObject.GetMetaObject();
}
Named and optional parameters
这似乎不是什么很难实现或很新颖的特性,只要编译器的支持就可以(VB很早就支持了)。估计加入的原因是群众的呼声太高了。带有可选参数方法的声明:public StreamReader OpenTextFile(
string path,
Encoding encoding = null,
bool detectEncoding = true,
int bufferSize = 1024);
命名参数必须在最后使用:OpenTextFile("foo.txt", Encoding.UTF8, bufferSize: 4096);
顺序不限:OpenTextFile(bufferSize: 4096, path: "foo.txt", detectEncoding: false);
Improved COM Interoperability
在C#中在调用COM对象如office对象时,经常需要写一堆不必要的参数:object fileName = "Test.docx";
object missing = System.Reflection.Missing.Value;
doc.SaveAs(ref fileName,
ref missing, ref missing, ref missing,
ref missing, ref missing, ref missing,
ref missing, ref missing, ref missing,
ref missing, ref missing, ref missing,
ref missing, ref missing, ref missing);
4.0中就可以直接写成:doc.SaveAs("Test.docx");
C#4.0对COM交互做了下面几方面的改进:Automatic object -> dynamic mapping
Optional and named parameters
Indexed properties
Optional “ref” modifier
Interop type embedding (“No PIA”)
对第1点和第5点的简单解释如下:在COM调用中,很多输入输出类型都是object,这样就必须知道返回对象的确切类型,强制转换后才可以调用相应的方法。在4.0中有了dynamic的支持,就可以在导入这些COM接口时将变量定义为dynamic而不是object,省掉了强制类型转换。PIA(Primary Interop Assemblies)是根据COM API生成的.Net Assembly,一般体积比较大。在4.0中运行时不需要PIA的存在,编译器会判断你的程序具体使用了哪一部分COM API,只把这部分用PIA包装,直接加入到你自己程序的Assembly里面。Co- and Contra-Variance
实在是不知道怎么翻译这两个词。在C#中,下面的类型转换是非法的:IList strings = new List();
IListobjects = strings;
因为你有可能会这样做,而编译器的静态检查无法查出错误:objects[0] = 5;
string s = strings[0];
4.0中在声明generic的Interface及Delegate时可以加in及out关键字,如:public interface IEnumerable : IEnumerable
{
IEnumerator GetEnumerator();
}
public interface IEnumerator : IEnumerator
{
bool MoveNext();
T Current { get; }
}public interface IComparer
{
public int Compare(T left, T right);
}
out关键字的意思是说IEnumerable中T只会被用在输出中,值不会被改变。这样将IEnumerable转为IEnumerable类型就是安全的。in的意思正好相反,是说IComparer中的T只会被用在输入中,这样就可以将IComparer安全的转为IComparer类型。前者被称为Co-Variance, 后者就是Contra-Variance。.Net4.0中使用out/in声明的Interface:System.Collections.Generic.IEnumerable
System.Collections.Generic.IEnumerator
System.Linq.IQueryable
System.Collections.Generic.IComparer
System.Collections.Generic.IEqualityComparer
System.IComparable
Delegate:System.Func
System.Action
System.Predicate
System.Comparison
System.EventHandler
Compiler as a Service
4.0中增加了与编译器相关的API,这样就可以将字符串作为代码动态编译执行,跟javascript好像。Video的最后,Anders做了一个很酷的demo,大概只用了二三十行代码,就实现了在控制台中直接执行C#语句,定义并调用函数,动态创建windows form,添加button等功能,看起来完全不逊色于Python,Ruby之类语言的控制台。沉寂了n年之后,CLR终于要出新版本了,这回Jeffrey Richter大侠没有借口不出新版的CLR via C#了吧:)Reference:视频: http://channel9.msdn.com/pdc2008/TL16/
PPT:http://mschnlnine.vo.llnwd.net/d1/pdc08/PPTX/TL16.pptx
示例代码及文档(New features in C# 4.0):http://code.msdn.microsoft.com/csharpfuture - 忍者神狒 - 博客园