Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Services > How to control the root name with which an array of a custom class objects are serialized????

Reply
Thread Tools

How to control the root name with which an array of a custom class objects are serialized????

 
 
Bob Rock
Guest
Posts: n/a
 
      06-04-2004
Hello,

is there a way of controlling the name with which an array of objects of a
custom class is serialized???

public class MyClass
{
.......
}

[WebMethod]
public MyClass[] MyMethod()
{
.......
.......
}

When serializing an array of MyClass objects through a web method I get as
the root node something like <ArrayOfMyClass1 xmlns="...." ....>.
I'd like to be able to define myself the name of the root element. Can this
be done???

Bob Rock



 
Reply With Quote
 
 
 
 
Dino Chiesa [Microsoft]
Guest
Posts: n/a
 
      06-04-2004
You should look at
http://msdn.microsoft.com/library/en...iceclients.asp

and
http://msdn.microsoft.com/library/en...attributes.asp

I think if you apply a
[return: XmlArray("ElementName")]
attribute to the webmethod, you may get what you want.

-Dino

"Bob Rock" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hello,
>
> is there a way of controlling the name with which an array of objects of a
> custom class is serialized???
>
> public class MyClass
> {
> ......
> }
>
> [WebMethod]
> public MyClass[] MyMethod()
> {
> ......
> ......
> }
>
> When serializing an array of MyClass objects through a web method I get as
> the root node something like <ArrayOfMyClass1 xmlns="...." ....>.
> I'd like to be able to define myself the name of the root element. Can

this
> be done???
>
> Bob Rock
>
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
class objects, method objects, function objects 7stud Python 11 03-20-2007 06:05 PM
Compilation fails when a windows form user control is assigned a strong name but it refers to an activex control which does not have strong name ashish_gokhale ASP .Net Web Controls 0 05-05-2005 01:38 PM
SRT DIvision, Square root and reciprocal square root alghazo@siu.edu VHDL 0 05-27-2004 06:23 AM
ControlDesigner not invoked on custom control when control is rendered within another custom control Matt Sokol ASP .Net Building Controls 2 08-07-2003 07:13 AM



Advertisments