I am learning C# using the Wrox Professional C# 3rd Edition book and am trying to apply what I have been learning about Collections to a project that I am working on. I have a COM Object Collection that I am attempting to extract properties from and am getting errors using this syntax:
foreach (object objItem in wrkspace.Errors)
{
Response.Write(objItem.Description);
}
This object I am trying to access has the following methods and properties according to the VS Object Browser:
Methods:
Add
GetEnumerator
Refresh
Remove
StartLogging
StopLogging
Properties:
Count
Item
LogFileName
Logging
No matter what I try, I am unable to access these properties or methods. When I programmed this same code in
VB.NET without using Option Strict, the code worked just fine allowing me to access the methods and properties. I have also tried using GetEnumerator with no success. Here is the code I used for that:
IEnumerator myErrorEnumerator = wrkspace.Errors.GetEnumerator();
I receive an error using this telling me that wrkspace.Errors doesn't have a definition for GetEnumerator. What am I missing here or am I totally off base.
Any guidance would be greatly appreciated. Thanks in advance. Take Care and Have a Great Day.