fayrehouse
13 years agoFrequent Contributor
Iterate over System.Collections.Generic.Dictionary with JScript
Folks,
I have an object "xobj.Keys" with ClrFullClassName of:
System.Collections.Generic.Dictionary`2+KeyCollection[[iTextSharp.text.pdf.PdfName, itextsharp, Version=5.4.4.0, Culture=neutral, PublicKeyToken=8354ae6d2174ddca],[iTextSharp.text.pdf.PdfObject, itextsharp, Version=5.4.4.0, Culture=neutral, PublicKeyToken=8354ae6d2174ddca]]
I've seen scattered on the web sample code in C# to the effect of
However, as we all know jscript does not support "foreach". I've tried:
for (var thiskey in xobj.Keys)
But this produces an "object doesn't support this action" error.
Can someone enlighten me on how to iterate through a dictionary such as this using Jscript?
I have an object "xobj.Keys" with ClrFullClassName of:
System.Collections.Generic.Dictionary`2+KeyCollection[[iTextSharp.text.pdf.PdfName, itextsharp, Version=5.4.4.0, Culture=neutral, PublicKeyToken=8354ae6d2174ddca],[iTextSharp.text.pdf.PdfObject, itextsharp, Version=5.4.4.0, Culture=neutral, PublicKeyToken=8354ae6d2174ddca]]
I've seen scattered on the web sample code in C# to the effect of
foreach (PdfName name in xobj.Keys)
However, as we all know jscript does not support "foreach". I've tried:
for (var thiskey in xobj.Keys)
But this produces an "object doesn't support this action" error.
Can someone enlighten me on how to iterate through a dictionary such as this using Jscript?