473,387 Members | 1,903 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

ICollection implementation

Hi,
I have a class which inherits from CollectionBase. I set it up long
ago and it works fine. I just ran FxCop on my project and it wants me to
"provide a strongly typed implementation of ICollection.CopyTo" for that
class. OK, I read some documentation and that looks fairly easy. I just add
code that looks something like

void ICollection.CopyTo(Array array, int index)
{
List.CopyTo(array, index);
}

The problem is that when I do this the compiler gives me the message

:\Inetpub\wwwroot\FlexiComplete\Features\FeatureDe finitionCollection.cs(26):
'FlexiVectorDatabase.FeatureDefinitionCollection.I Collection.CopyTo(System.Array,
int)': containing class does not implement interface
'System.Collections.ICollection'

I checked some more documentation and it really looks to me like a class
which inherits CollectionBase should implement ICollection. I tried adding
methods for SynchRoot, IsSynchronized, and Count, but that didn't help.

I am using C#.Net 1.1
Just so you know, I don't understand interfaces and may be missing something
very basic. If so, please let me know.
Any help with this issue would be appreciated.
Thanks!
Ethan Strauss Ph.D.
Bioinformatics Scientist
Promega Corporation
2800 Woods Hollow Rd.
Madison, WI 53711
608-274-4330
800-356-9526
et***********@promega.com
Apr 18 '07 #1
1 7446
Hi,

I checked some more documentation and it really looks to me like a class
which inherits CollectionBase should implement ICollection. I tried adding
methods for SynchRoot, IsSynchronized, and Count, but that didn't help.
Do not include ICollection.

declare it like
public void CopyTo(Array array, int index)
{
List.CopyTo(array, index);
}
Apr 18 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Lars-Erik Aabech | last post by:
Hi! I've got problems with serializing my collections of business objects. The objects themselves serialize fine, but the collections fail. I've got the following structure: Base collection...
2
by: Nick | last post by:
Out of context and just asking but why does the following code work? Hashtable ht = new Hashtable(); ht.Add(1,1); .... .... ..... ICollection collection = ht.Values; Hashtable ht2 =...
7
by: MrNobody | last post by:
since ArrayList implements ICollection, is there a quick way to convert an ICollection into ArrayList (besides actually iterating through each element in the ICollection and explicitly adding them...
3
by: andrew.miadowicz | last post by:
It's funny that I've only now run into this question, after a few years of using C#, but I find it intriguiging all the same. All the more so, that the generic version of ICollection in .Net...
1
by: Janus Knudsen | last post by:
Hello :O) Im in the process of learning asp.net, and i'm reading a nice book. But then suddenly i came across this: public ICollection DataLoad() { DataTable dtEmployee = new DataTable();
3
by: Dave Booker | last post by:
Am I missing something here? It looks like the generic Queue<T> implements Enumerable<T> and ICollection but not ICollection<T>. (I want to use it in an interface that wants an ICollection<T>.) ...
2
by: Allan Ebdrup | last post by:
I have a public sealed Class A that implements the interface I. Now I want to pass an ICollection<Aas a parameter to a method that takes a parameter of the type ICollection<Ibut I get the error: ...
0
by: emma_middlebrook | last post by:
Hi Hopefully the title is quite accurate but here's some more information. I have a load of ICollection<references hanging off a class e.g. ICollection<X>, ICollection<Yetc etc. Each of the...
2
by: per9000 | last post by:
Hi, *background* I want a class containing an int (a list of sets of integer). This should be hidden for the user and he/she should be able to insert his/her favourite data structure so to be a...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.