Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / Web Services / November 2003

Tip: Looking for answers? Try searching our database.

structures vs classes

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Gian U. Uy - 27 Nov 2003 02:55 GMT
Hi!

I'd like to know is what are the prons and cons of using structures (data
types declared as struct [in c#] or structure [in vb.net]) as against
classes when passing data from and to a web service?
Scott M. - 29 Nov 2003 05:34 GMT
In general, structures should be used for managing the state (property
values - data) of something and classes should be used to manage state  and
behavior (methods) of something.

Because structures are value types, they are managed on the stack as opposed
to classes, which are reference types and therefore managed on the heap.
Since the stack is a more limited storage area than the heap, thinner
objects are generally placed there and more complex objects (classes) go on
the heap, which is a bigger storage area.

Also, with value types (structures), you can easily pass them ByVal whereas
with a reference type (classes), you pass ByRef.

> Hi!
>
> I'd like to know is what are the prons and cons of using structures (data
> types declared as struct [in c#] or structure [in vb.net]) as against
> classes when passing data from and to a web service?
Saurabh Nandu - 29 Nov 2003 05:58 GMT
Hi,

There is no such difference from a Web Service point of view, since the data
sent over the web service is in XML format which is independent of being
generated from a class or struct.'

Regards,
Akila
[MVP]
Gian U. Uy - 29 Nov 2003 16:21 GMT
Thanks. This exactly answers my inquiry

> Hi,
>
[quoted text clipped - 5 lines]
> Akila
> [MVP]

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.