本文介绍了让我用新的&QUOT的方式;动态"关键字在C#4.0的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
下面是在4.0版本的新的C#未来称为动态。告诉我,我可以用它在我的code和方式这个未来如何能帮助我吗?
Here is new C# future in version 4.0 known as dynamic. Show me the way i can use it in my code and how this future can help me?
相关问题:
- <一个href="http://stackoverflow.com/questions/298277/does-the-new-dynamic-c-40-keyword-de$p$pcate-the-var-keyword">Does新的动态C#4.0关键字去precate的变种的关键字?
- What你认为新的C#4.0动态的关键字?
- Does the new ‘dynamic’ C# 4.0 keyword deprecate the ‘var’ keyword ?
- What do you think of the new C# 4.0 ‘dynamic’ keyword?
推荐答案
我们使用C#动态的关键字与TDD。
We use the C# "dynamic" keyword with TDD.
这code没有编译,因为该方法加法不落实
This code doesn't compile because the method "Addition" is not implemented
[TestMethod()]
public void CalculatorThingAdd_2PositiveNumbers_ResultAdded()
{
CalculatorThing myCalculator = new CalculatorThing();
int result = 0;
int expcected = 3;
// --> CalculatorThing does not contain a definition for 'Addition'
result = myCalculator.Addition(1, 2);
Assert.AreEqual(result, expcected);
}
通过动态关键字的code编译和测试失败! - > TDD
With the "dynamic" keyword the code compiles and the test fails! --> TDD
请参阅答案这里http://stackoverflow.com/questions/244302/what-do-you-think-of-the-new-c-4-0-dynamic-keyword/2243818#2243818
这篇关于让我用新的&QUOT的方式;动态&QUOT;关键字在C#4.0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!