Click here to Skip to main content
15,924,195 members
Home / Discussions / C#
   

C#

 
AnswerRe: What Are Structs For In C#? Pin
Guffa19-Aug-08 11:11
Guffa19-Aug-08 11:11 
AnswerRe: What Are Structs For In C#? Pin
vikas amin19-Aug-08 11:53
vikas amin19-Aug-08 11:53 
GeneralRe: What Are Structs For In C#? Pin
Colin Angus Mackay19-Aug-08 11:57
Colin Angus Mackay19-Aug-08 11:57 
JokeRe: What Are Structs For In C#? Pin
PIEBALDconsult19-Aug-08 13:28
mvePIEBALDconsult19-Aug-08 13:28 
GeneralRe: What Are Structs For In C#? Pin
Colin Angus Mackay19-Aug-08 14:16
Colin Angus Mackay19-Aug-08 14:16 
GeneralRe: What Are Structs For In C#? Pin
chaiguy133719-Aug-08 15:30
chaiguy133719-Aug-08 15:30 
GeneralRe: What Are Structs For In C#? Pin
vikas amin20-Aug-08 5:44
vikas amin20-Aug-08 5:44 
GeneralRe: What Are Structs For In C#? Pin
Guffa19-Aug-08 22:34
Guffa19-Aug-08 22:34 
vikas amin wrote:
By using structs, you can create objects that behave like the built-in types


What he means is that you can create types with value type semantics.

vikas amin wrote:
when you instantiate a struct, it gets created on the stack.


That is an over-simplification that can get confusing.

A struct is stored as inline data. If declared as a local varaible it's allocated on the stack, but if declared as a member of another type, it's allocated where that type is allocated. As a member of a class, it will be allocated on the heap along with the other members of that class instance.

vikas amin wrote:
This will yield performance gains.


No, this may yield performance gains, if the struct is sufficiently small, and used in such a way that it takes advantage of how value types work.

Despite everything, the person most likely to be fooling you next is yourself.

GeneralRe: What Are Structs For In C#? Pin
vikas amin20-Aug-08 5:49
vikas amin20-Aug-08 5:49 
AnswerRe: What Are Structs For In C#? Pin
DaveyM6919-Aug-08 12:21
professionalDaveyM6919-Aug-08 12:21 
GeneralRe: What Are Structs For In C#? Pin
Csharp_Raja19-Aug-08 22:59
Csharp_Raja19-Aug-08 22:59 
Questionaxmediaplayer and e.newState [modified] Pin
electriac19-Aug-08 10:17
electriac19-Aug-08 10:17 
AnswerRe: axmediaplayer and e.newState Pin
electriac19-Aug-08 11:21
electriac19-Aug-08 11:21 
QuestionTrying to use old assembly version? Pin
eggsovereasy19-Aug-08 9:25
eggsovereasy19-Aug-08 9:25 
AnswerRe: Trying to use old assembly version? Pin
leppie19-Aug-08 23:11
leppie19-Aug-08 23:11 
GeneralRe: Trying to use old assembly version? Pin
eggsovereasy20-Aug-08 4:20
eggsovereasy20-Aug-08 4:20 
Questionlock .net code Pin
sepel19-Aug-08 4:57
sepel19-Aug-08 4:57 
AnswerRe: lock .net code Pin
Manas Bhardwaj19-Aug-08 5:05
professionalManas Bhardwaj19-Aug-08 5:05 
GeneralRe: lock .net code Pin
Colin Angus Mackay19-Aug-08 5:25
Colin Angus Mackay19-Aug-08 5:25 
GeneralRe: lock .net code Pin
Paul Conrad19-Aug-08 5:35
professionalPaul Conrad19-Aug-08 5:35 
GeneralRe: lock .net code Pin
MarkB77719-Aug-08 12:44
MarkB77719-Aug-08 12:44 
AnswerRe: lock .net code Pin
hammerstein0519-Aug-08 5:34
hammerstein0519-Aug-08 5:34 
GeneralRe: lock .net code Pin
Paul Conrad19-Aug-08 5:39
professionalPaul Conrad19-Aug-08 5:39 
AnswerRe: lock .net code Pin
Paul Conrad19-Aug-08 5:37
professionalPaul Conrad19-Aug-08 5:37 
GeneralRe: lock .net code Pin
led mike19-Aug-08 6:04
led mike19-Aug-08 6:04 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.