2
Answers

DictionaryEntry

Ask a question
Maha

Maha

11y
2.8k
1
http://www.dotnetperls.com/dictionaryentry
Above website is saying that "DictionaryEntry is used with Hashtable". Also example program is given.

But 3rd program in the following website is using DictionaryEntry without Hashtable. Problem is highlighted. I wish to know the reason for discrepancy.
http://www.dotnetperls.com/exception

using System;
using System.Collections;

class Program
{
static void Main()
{
try
{
// Create new exception.
var ex = new DivideByZeroException("Message");
// Set the data dictionary.
ex.Data["Time"] = DateTime.Now;
ex.Data["Flag"] = true;
// Throw it!
throw ex;
}
catch (Exception ex)
{
// Display the exception's data dictionary.
foreach (DictionaryEntry pair in ex.Data)
{
Console.WriteLine("{0} = {1}", pair.Key, pair.Value);
}
}
Console.ReadKey();
}
}


Answers (2)