Solved

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

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

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…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

803 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