I want to use the Data
property to store information I want to throw in a new exception and I've figured out how I can loop through each of the DictionaryEntries
with this snippet
foreach (DictionaryEntry de in ex.Data)
But what I'd prefer to do is get the value by its key name because I have different object types in that Data
object. Its easier to cast them to the right kind of object if I can get the value by its key name.
Anyone know how to get the Exception.Data
dictionary entries by key name?
If you know the key it would be much more efficient to use the Dictionary for what it is good for:
var yourObj = ex.Data["your_key"];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With