B
Bob
By using foreach statement of C#, we can loop through
IHTMLAttributeCollection as follows:
IHTMLAttributeCollection myAttrColl =
(IHTMLAttributeCollection) myNode. attributes;
IHTMLDOMAttribute myAttr;
foreach myAttr in myAttrColl
{
if (myAttr.specified) //do something
}
How can we accomplish the same by using the 'for' loop? I
am asking this since I need to write the same code for
both C# and J#. But in J#, there is no foreach loop. Using
for loop, I tried the following:
for (int i=0; i < MyAttrColl.get_length(); i++)
{
myAttr = (IHTMLDOMAttribute) oAttrColl.item(i);
//now do something
}
But the syntax for item method is IHTMLDOMAttribute.item
(ref Object name). Hence, I get an error saying: method
IHTMLDOMAttribute.item(int i) not found.
Please help?
Thanks,
Bob
IHTMLAttributeCollection as follows:
IHTMLAttributeCollection myAttrColl =
(IHTMLAttributeCollection) myNode. attributes;
IHTMLDOMAttribute myAttr;
foreach myAttr in myAttrColl
{
if (myAttr.specified) //do something
}
How can we accomplish the same by using the 'for' loop? I
am asking this since I need to write the same code for
both C# and J#. But in J#, there is no foreach loop. Using
for loop, I tried the following:
for (int i=0; i < MyAttrColl.get_length(); i++)
{
myAttr = (IHTMLDOMAttribute) oAttrColl.item(i);
//now do something
}
But the syntax for item method is IHTMLDOMAttribute.item
(ref Object name). Hence, I get an error saying: method
IHTMLDOMAttribute.item(int i) not found.
Please help?
Thanks,
Bob