Click here to Skip to main content
15,915,019 members
Home / Discussions / C#
   

C#

 
GeneralRe: Marshalling array of struct Pin
poda26-Sep-10 23:31
poda26-Sep-10 23:31 
GeneralRe: Marshalling array of struct Pin
Luc Pattyn27-Sep-10 0:21
sitebuilderLuc Pattyn27-Sep-10 0:21 
AnswerRe: Marshalling array of struct Pin
David Knechtges24-Sep-10 3:42
David Knechtges24-Sep-10 3:42 
GeneralRe: Marshalling array of struct Pin
poda26-Sep-10 17:08
poda26-Sep-10 17:08 
AnswerSolved: Marshalling array of struct containing array of struct Pin
poda27-Sep-10 17:47
poda27-Sep-10 17:47 
Questiondeployment of c# prject......... Pin
KAMAL SHYAM23-Sep-10 11:08
KAMAL SHYAM23-Sep-10 11:08 
AnswerRe: deployment of c# prject......... Pin
AspDotNetDev23-Sep-10 11:13
protectorAspDotNetDev23-Sep-10 11:13 
AnswerRe: deployment of c# prject......... Pin
The Man from U.N.C.L.E.23-Sep-10 11:22
The Man from U.N.C.L.E.23-Sep-10 11:22 
AnswerRe: deployment of c# prject......... PinPopular
PIEBALDconsult23-Sep-10 18:01
mvePIEBALDconsult23-Sep-10 18:01 
AnswerRe: deployment of c# prject......... Pin
Abhinav S23-Sep-10 19:32
Abhinav S23-Sep-10 19:32 
QuestionInspired by "Should we really use struct or not?" question Pin
Łukasz Nowakowski23-Sep-10 4:19
Łukasz Nowakowski23-Sep-10 4:19 
AnswerRe: Inspired by "Should we really use struct or not?" question Pin
Pete O'Hanlon23-Sep-10 4:43
mvePete O'Hanlon23-Sep-10 4:43 
GeneralRe: Inspired by "Should we really use struct or not?" question Pin
Luc Pattyn23-Sep-10 5:55
sitebuilderLuc Pattyn23-Sep-10 5:55 
GeneralRe: Inspired by "Should we really use struct or not?" question Pin
AspDotNetDev23-Sep-10 10:18
protectorAspDotNetDev23-Sep-10 10:18 
GeneralRe: Inspired by "Should we really use struct or not?" question Pin
Luc Pattyn23-Sep-10 10:40
sitebuilderLuc Pattyn23-Sep-10 10:40 
AnswerRe: Inspired by "Should we really use struct or not?" question Pin
Kevin McFarlane24-Sep-10 4:30
Kevin McFarlane24-Sep-10 4:30 
QuestionErrorProvider logic to avoid DialogResult.OK button completion? Pin
Chesnokov Yuriy23-Sep-10 4:02
professionalChesnokov Yuriy23-Sep-10 4:02 
AnswerRe: ErrorProvider logic to avoid DialogResult.OK button completion? Pin
Michael Eber30-Sep-10 12:08
Michael Eber30-Sep-10 12:08 
QuestionShould we really use struct or not? Pin
stephen.darling23-Sep-10 2:11
stephen.darling23-Sep-10 2:11 
AnswerRe: Should we really use struct or not? Pin
Luc Pattyn23-Sep-10 2:52
sitebuilderLuc Pattyn23-Sep-10 2:52 
AnswerRe: Should we really use struct or not? Pin
Ian Shlasko23-Sep-10 2:52
Ian Shlasko23-Sep-10 2:52 
The difference between structs and classes is fairly simple (Doesn't make sense to differentiate between structs and "objects," since EVERYTHING is an object, including a struct).

Structure-type variables contain the actual structure. Class-type variables contain a POINTER to the actual class. That means multiple variables can point to the same class, but only one variable can point to a given structure. If you type a = b where 'b' is a structure, 'a' will gain a COPY of that structure. If 'b' is a class, 'a' will just point to the same class, so if you make changes to 'a', you'll see the same result in 'b'.

Structures are more efficient for small, immutable objects (Objects that cannot be changed once created). Classes are good for everything else. Of course there are exceptions to this, but that's a good starting point.

stephen.darling wrote:
If it is better to use objects, is it valid to create such an object that has no public or private methods other than its constructor, and instead has a bunch of public variable declerations?

That's bad practice... In most cases, you don't want to expose variable declarations. Make properties or methods to return them, so you can control the flow of data.
Proud to have finally moved to the A-Ark. Which one are you in?
Author of the Guardians Saga (Sci-Fi/Fantasy novels)

GeneralRe: Should we really use struct or not? Pin
stephen.darling23-Sep-10 2:57
stephen.darling23-Sep-10 2:57 
Questionreportviewer in multi-tier winform environment Pin
redspiderke23-Sep-10 1:50
redspiderke23-Sep-10 1:50 
AnswerRe: reportviewer in multi-tier winform environment Pin
Vimalsoft(Pty) Ltd23-Sep-10 3:16
professionalVimalsoft(Pty) Ltd23-Sep-10 3:16 
QuestionHow to add items to dictionary as you create it? Pin
Chesnokov Yuriy22-Sep-10 21:57
professionalChesnokov Yuriy22-Sep-10 21:57 

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.