

public void HashtableAddTest(){
Hashtable hashtable1;
hashtable1 = new Hashtable();
hashtable1.Add("Key1", "value1");
hashtable1.Add("Key2", "value2");
Assert.AreEqual("value1", hashtable1["Key1"], "Wrong object returned!");
Assert.AreEqual("value2", hashtable1["Key2"], "Wrong object returned!");
}public void HashtableAddTest(){
Hashtable ht = new Hashtable();
ht.Add("Key1", "value1");
ht.Add("Key2", "value2");
Assert.AreEqual("value1", ht["Key1"], "Wrong object returned!");
Assert.AreEqual("value2", ht["Key2"], "Wrong object returned!");
}
尽管上述代码中存在一些小的差异,但它们在功能上是完全相同的。
虽然该示例是一种显示实际代码与反编译代码之间对比的好方法,但在我看来,它并不代表 .NET Reflector 所具有的最佳用途 — 分析 .NET 框架程序集和方法。.NET 框架提供了许多执行类似操作的不同方法。例如,如果您需要从 XML 中读取一组数据,则存在多种使用 XmlDocument、XPathNavigator 或