473,386 Members | 1,745 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,386 software developers and data experts.

How do I add a default accessor to a collection class

Lou
I getthis error when trying to serialize a collection class.

Dim Serialize As XmlSerializer = New XmlSerializer(GetType(cButtons))
"You must implement a default accessor on MyCollection.cButtons because it
inherits from ICollection.
Feb 9 '07 #1
2 10189
You must have a default "New" with no arguments. The serialization wants to
be able to create the class and if there are only constructors with
parameters it cannot perform its duty.
"Lou" <lo********@comcast.netwrote in message
news:%2****************@TK2MSFTNGP05.phx.gbl...
>I getthis error when trying to serialize a collection class.

Dim Serialize As XmlSerializer = New XmlSerializer(GetType(cButtons))
"You must implement a default accessor on MyCollection.cButtons because it
inherits from ICollection.
Feb 9 '07 #2
Lou
There is one

Public Sub New()

End Sub

"Lloyd Sheen" <a@b.cwrote in message
news:19**********************************@microsof t.com...
You must have a default "New" with no arguments. The serialization wants
to be able to create the class and if there are only constructors with
parameters it cannot perform its duty.
"Lou" <lo********@comcast.netwrote in message
news:%2****************@TK2MSFTNGP05.phx.gbl...
>>I getthis error when trying to serialize a collection class.

Dim Serialize As XmlSerializer = New XmlSerializer(GetType(cButtons))
"You must implement a default accessor on MyCollection.cButtons because
it inherits from ICollection.

Feb 9 '07 #3

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

Similar topics

22
by: mirandacascade | last post by:
When I look at how classes are set up in other languages (e.g. C++), I often observe the following patterns: 1) for each data member, the class will have an accessor member function (a...
6
by: Jason Shohet | last post by:
I have a class with protected variables and some accessor methods, , get, set ... Maybe I have a brain blockage today but I'm thinking, why not just make those variables public. After all,...
3
by: Eric Eggermann | last post by:
Hello, I'm trying to use xsd.exe to create a schema from my exe and I get an error saying that my collection class does not implement a default accessor which it must since it inherits from...
11
by: Kavvy | last post by:
How come a lot of the examples I have seen on the net define accessor pairs within a class, and then only ever use the accessor outside the class? When used within the class the variable is...
7
by: Javaman59 | last post by:
This is probably common knowledge to .Net gurus, but please bear with me while I share a discovery with the group... I needed to create a public lock on a class, as follows... class Locked {...
3
by: Daniel Lidström | last post by:
I have a CS class I wish to write in MC++: public class UnitsCollection : ArrayList { new public Units this { get { return (Units) base; } set { base = value; } } }
5
by: Stacey Levine | last post by:
I have a webservice that I wanted to return an ArrayList..Well the service compiles and runs when I have the output defined as ArrayList, but the WSDL defines the output as an Object so I was...
2
by: Justin Drerup | last post by:
I'm tryng to return a custom object that contains a collection of MembershipUsers through a web service however I receive the following error when trying to return the object through a web method:...
8
by: AAJ | last post by:
Hi all I would like to have a class that can set/return values of different datatype via a single accessor, i.e. overload the accessor i.e. something like DateTime m_DateValue; string...
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: 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
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: 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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.