Solved

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

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

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
ado.net AddWithValue when using IN condition 7 45
Adjust the codes 3 63
How to calculate the sum of all rows at each new row in C# 4 61
Put File 6 37
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
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

751 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