Solved

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

Posted on 2006-07-21
4
349 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
  • 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Extention Methods in C# 3.0 by Ivo Stoykov C# 3.0 offers extension methods. They allow extending existing classes without changing the class's source code or relying on inheritance. These are static methods invoked as instance method. This…
Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
A short film showing how OnPage and Connectwise integration works.
Delivering innovative fully-managed cloud services for mission-critical applications requires expertise in multiple areas plus vision and commitment. Meet a few of the people behind the quality services of Concerto.

943 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

Need Help in Real-Time?

Connect with top rated Experts

4 Experts available now in Live!

Get 1:1 Help Now