Solved

What is difference between class and data strcture

Posted on 2011-09-10
4
315 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 100 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 350 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:navneethegde
navneethegde earned 50 total points
ID: 36520923
0
 

Author Closing Comment

by:N_Sri
ID: 36541402
thankyou
0

Featured Post

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

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

Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

751 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