473,387 Members | 1,501 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.

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 10190
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: 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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.