Click here to Skip to main content
16,004,991 members
Home / Discussions / C#
   

C#

 
QuestionWhat Are Structs For In C#? Pin
Kevin Marois19-Aug-08 11:03
professionalKevin Marois19-Aug-08 11:03 
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 
vikas amin wrote:
objects that behave like the built-in

Such as?

--> By build-in I mean value type .

vikas amin wrote:
enjoy their benefits


Which benefits?

--> benefits of value type .

vikas amin wrote:
it gets created on the stack. This will yield performance gains


So, if I create a struct that has, say, 100 ints. That will be more performant than a class with the same?

What if I need to pass that object around? Say I need to pass it into a method or two?


--> Same solution don’t work in every scenario .
Its a fact that if you want to pass a large object to a method,
C# can use Ref keyword
--> What if you have 100 user defined variables to be created for a
short time say say for single calculation ,its a fact that Heap-
managed objects take more time to allocate, access, and update
than stack-managed ones
so you can use structure to speed up such process , i don't deny
that there are many more way to improve performance .

--> while using unmanaged code or say when use pinvoke to call native
code you set the structure attributes for performance


Thanks for the comments , please let me know if I am wrong some where

Vikas Amin

My First Article on CP" Virtual Serial Port "[^]
modified on Thursday, July 24, 2008 5:33 PM

GeneralRe: What Are Structs For In C#? Pin
Guffa19-Aug-08 22:34
Guffa19-Aug-08 22:34 
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 

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.