Click here to Skip to main content
15,895,011 members
Home / Discussions / C#
   

C#

 
AnswerRe: Do I need to create a struct? Pin
OriginalGriff14-Dec-09 5:16
mveOriginalGriff14-Dec-09 5:16 
GeneralRe: Do I need to create a struct? Pin
bbranded14-Dec-09 5:17
bbranded14-Dec-09 5:17 
GeneralRe: Do I need to create a struct? Pin
OriginalGriff14-Dec-09 5:21
mveOriginalGriff14-Dec-09 5:21 
AnswerRe: Do I need to create a struct? Pin
Keith Barrow14-Dec-09 5:18
professionalKeith Barrow14-Dec-09 5:18 
GeneralRe: Do I need to create a struct? Pin
Saksida Bojan14-Dec-09 5:58
Saksida Bojan14-Dec-09 5:58 
GeneralRe: Do I need to create a struct? Pin
N a v a n e e t h14-Dec-09 6:07
N a v a n e e t h14-Dec-09 6:07 
GeneralRe: Do I need to create a struct? Pin
Saksida Bojan14-Dec-09 6:14
Saksida Bojan14-Dec-09 6:14 
GeneralRe: Do I need to create a struct? Pin
Keith Barrow14-Dec-09 6:40
professionalKeith Barrow14-Dec-09 6:40 
You might, under certain circumstances use more memory.
See
http://msdn.microsoft.com/en-us/library/ah19swz4(VS.71).aspx[^]

The things to note are (Quotes directly from above):
1) Struct are value types. Classes are reference types.
2) Structs have no inheritence (other than object).
3) "The struct type is suitable for representing lightweight objects such as Point [e.g. a Cartesian Co-ordinate]"
4) "Unless you need reference type semantics, a class that is smaller than 16 bytes may be more efficiently handled by the system as a struct."


C# is very different to c++ in this matter, I've been developing C# for about 8 years now, and have never needed a struct (though I have used them from 3rd party stuff).

CCC solved so far: 2 (including a Hard One!)
37!?!! - Randall, Clerks

GeneralRe: Do I need to create a struct? Pin
bbranded14-Dec-09 7:27
bbranded14-Dec-09 7:27 
GeneralRe: Do I need to create a struct? Pin
Keith Barrow14-Dec-09 8:03
professionalKeith Barrow14-Dec-09 8:03 
GeneralRe: Do I need to create a struct? Pin
bbranded14-Dec-09 8:07
bbranded14-Dec-09 8:07 
GeneralRe: Do I need to create a struct? Pin
Keith Barrow14-Dec-09 8:18
professionalKeith Barrow14-Dec-09 8:18 
GeneralRe: Do I need to create a struct? Pin
bbranded14-Dec-09 8:37
bbranded14-Dec-09 8:37 
GeneralRe: Do I need to create a struct? Pin
Keith Barrow15-Dec-09 1:16
professionalKeith Barrow15-Dec-09 1:16 
AnswerRe: Do I need to create a struct? Pin
Luc Pattyn14-Dec-09 6:15
sitebuilderLuc Pattyn14-Dec-09 6:15 
QuestionSending CSV file when form fillout. Pin
zjaffary14-Dec-09 5:00
zjaffary14-Dec-09 5:00 
AnswerRe: Sending CSV file when form fillout. Pin
Saksida Bojan14-Dec-09 6:06
Saksida Bojan14-Dec-09 6:06 
QuestionAuthentication in a console application Pin
vinothkumar_Dhakshinamoorthy14-Dec-09 3:59
vinothkumar_Dhakshinamoorthy14-Dec-09 3:59 
AnswerRe: Authentication in a console application Pin
#realJSOP14-Dec-09 4:28
mve#realJSOP14-Dec-09 4:28 
Questionbackup Pin
farokhian14-Dec-09 3:47
farokhian14-Dec-09 3:47 
Questionthe Registry and DOS commands Pin
Antonio JVS14-Dec-09 2:40
Antonio JVS14-Dec-09 2:40 
AnswerRe: the Registry and DOS commands Pin
Md. Marufuzzaman14-Dec-09 3:01
professionalMd. Marufuzzaman14-Dec-09 3:01 
GeneralRe: the Registry and DOS commands Pin
Antonio JVS14-Dec-09 3:47
Antonio JVS14-Dec-09 3:47 
AnswerRe: the Registry and DOS commands Pin
S. Brozius14-Dec-09 3:18
S. Brozius14-Dec-09 3:18 
AnswerRe: the Registry and DOS commands [modified] Pin
EliottA14-Dec-09 3:28
EliottA14-Dec-09 3:28 

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.