Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

What is difference between class and data strcture

Posted on 2011-09-10
4
Medium Priority
?
320 Views
Last Modified: 2012-05-12
What is difference between class and data strcture?
0
Comment
Question by:N_Sri
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 75

Assisted Solution

by:käµfm³d 👽
käµfm³d   👽 earned 400 total points
ID: 36517837
I would venture to say that the difference is insignificant. A data structure is just a way to organise data for efficient transferring and processing. A class can be thought of in the same manner. The only reason I hesitate to say they are one and the same is because you also have the concept of structures (i.e. struct) in C#.
0
 
LVL 70

Accepted Solution

by:
Éric Moreau earned 1400 total points
ID: 36518812
a lot of good resources:
http://msdn.microsoft.com/en-us/library/aa289521(VS.71).aspx
http://social.msdn.microsoft.com/Forums/en-US/Vsexpressvb/thread/6923cbe6-12b7-4e97-a4f5-3d9ebdfc75f2
http://dotnetguts.blogspot.com/2007/07/struct-vs-class-in-net.html

from the second one:
Classes are stored in memory via a heap whereas structs are stored in memory via a stack. Stacks are faster and more efficient and there's no need for the CLR garbage collector ro reclaim memory for structs (which takes time and resources). Structs are value types and all value types are stored on the stack.
 
Basically, classes are reference types and structs are value types. Reference types get stored differently than value types. Value types are stored more efficiently but only when they contain little data.
0
 
LVL 15

Assisted Solution

by:Navneet
Navneet earned 200 total points
ID: 36520923
0
 

Author Closing Comment

by:N_Sri
ID: 36541402
thankyou
0

Featured Post

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: Ivo
C# And Nullable Types Since 2.0 C# has Nullable(T) Generic Structure. The idea behind is to allow value type objects to have null values just like reference types have. This concerns scenarios where not all data sources have values (like a databa…
In order to hide the "ugly" records selectors (triangles) in the rowheaders, here are some suggestions. Microsoft doesn't have a direct method/property to do it. You can only hide the rowheader column. First solution, the easy way The first sol…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question