Solved

I'm getting NotImplementedException  when I tried to get the Count property from the IContianer object.

Posted on 2006-07-21
4
365 Views
Last Modified: 2010-08-05
I'm getting NotImplementedException  when I tried to get the Count property from the IContianer object iconComputers.  What does this error mean?  How can I correct this problem?  Thanks.


//deGlobalComputers is a DirectoryEntry object.
                    IADsContainer iconComputers = (IADsContainer)deGlobalComputers.NativeObject;
                    IADsContainer iconUsers = (IADsContainer)deGlobalComputers.NativeObject;
                    IADsContainer iconGroups = (IADsContainer)deGlobalComputers.NativeObject;
                    iconComputers.Filter = new object[] {"meeting"};
                    int numOfComputers = iconComputers.Count;
--
Thanks.
0
Comment
Question by:lapucca
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 30

Accepted Solution

by:
Alexandre Simões earned 250 total points
ID: 17159303
Hi!

IContainer is an interface, not a class.
The code you provided is abstract, as you're dealing only with method signatures, not real code.

IADsContainer iconComputers = (IADsContainer)deGlobalComputers.NativeObject;
Here looks like you're assigning the (IADsContainer)deGlobalComputers.NativeObject to an Interface.

The exception you're having is automatically writen by the VS 2005 when we implement an interface thru Refactoring.

I don't know what that IADsContainer object is... by the name looks like an Interface (starts with an I), but if you have more code you can post it.

Alex
0
 
LVL 5

Expert Comment

by:paulb1989
ID: 17161374
If 'Count' not implemented then maybe you could do this:

int numOfComputers = iconComputers.Count;
foreach (object o in iconComputers)
    numOfComputers++;
0
 
LVL 5

Assisted Solution

by:paulb1989
paulb1989 earned 250 total points
ID: 17161379
Sorry, I meant this:

int numOfComputers = 0;
foreach (object o in iconComputers)
    numOfComputers++;
0
 

Author Comment

by:lapucca
ID: 17163813
Thanks Paul.  I already have coded it that way but I want to know why the IContainer code won't work.  As both of you have pointed out that Count property isn't implemented so I'll just split the points between you 2.  Thank you both.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question