Click here to Skip to main content
15,918,243 members
Home / Discussions / C#
   

C#

 
GeneralRe: Implementing an interface question Pin
leppie10-Oct-08 2:41
leppie10-Oct-08 2:41 
GeneralRe: Implementing an interface question Pin
Harvey Saayman10-Oct-08 2:44
Harvey Saayman10-Oct-08 2:44 
GeneralRe: Implementing an interface question Pin
DaveyM6910-Oct-08 3:01
professionalDaveyM6910-Oct-08 3:01 
GeneralRe: Implementing an interface question Pin
leppie10-Oct-08 3:51
leppie10-Oct-08 3:51 
GeneralRe: Implementing an interface question Pin
DaveyM6910-Oct-08 4:28
professionalDaveyM6910-Oct-08 4:28 
GeneralRe: Implementing an interface question Pin
Guffa10-Oct-08 6:26
Guffa10-Oct-08 6:26 
GeneralRe: Implementing an interface question Pin
DaveyM6910-Oct-08 8:05
professionalDaveyM6910-Oct-08 8:05 
GeneralRe: Implementing an interface question Pin
Guffa10-Oct-08 12:08
Guffa10-Oct-08 12:08 
DaveyM69 wrote:
I can work on the copy, make any changes I like and then just forget the whole thing if I don't want/need to commit them. If it's a class, to have that flexibility you have to implement some sort of cloning method and work on the clone, then you still have to remember to reassign.


I see your point, and that would work as long as it's only you who work with the code. If someone else has to take over your code, they can easily be fooled by this uncommon usage of structs.

A struct is a value type, and the semantics of a value type is to represent a single value of some kind. If you have several distinct values in a struct it doesn't behave as a value type any more, and you should use a class instead.

Also, a struct should not be larger than 16 bytes. A small struct can be copied using only a pair of machine instruction, while a large struct requires a loop to copy the memory area each time.

It's easier to use a struct for cloning instead of implementing proper cloning for a class, but you get worse performance.

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

GeneralRe: Implementing an interface question Pin
DaveyM6910-Oct-08 13:00
professionalDaveyM6910-Oct-08 13:00 
Questiondata formating Pin
muharrem10-Oct-08 1:40
muharrem10-Oct-08 1:40 
AnswerRe: data formating Pin
DaveyM6910-Oct-08 1:49
professionalDaveyM6910-Oct-08 1:49 
QuestionDataSource Pin
reza assar10-Oct-08 1:34
reza assar10-Oct-08 1:34 
AnswerRe: DataSource Pin
SeMartens10-Oct-08 1:44
SeMartens10-Oct-08 1:44 
AnswerRe: DataSource Pin
nelsonpaixao10-Oct-08 12:54
nelsonpaixao10-Oct-08 12:54 
Questioncreat a shortcut Pin
reza assar10-Oct-08 1:31
reza assar10-Oct-08 1:31 
AnswerRe: creat a shortcut Pin
DaveyM6910-Oct-08 1:33
professionalDaveyM6910-Oct-08 1:33 
QuestionOut of memory errors on drawing images in Pdf file Pin
Ninii10-Oct-08 1:23
Ninii10-Oct-08 1:23 
AnswerRe: Out of memory errors on drawing images in Pdf file Pin
leppie10-Oct-08 2:28
leppie10-Oct-08 2:28 
GeneralRe: Out of memory errors on drawing images in Pdf file Pin
Ninii10-Oct-08 21:48
Ninii10-Oct-08 21:48 
Questionhow to show a range of date using calender control in c# .net Pin
aurosikhadas10-Oct-08 1:01
aurosikhadas10-Oct-08 1:01 
AnswerRe: how to show a range of date using calender control in c# .net Pin
leppie10-Oct-08 2:30
leppie10-Oct-08 2:30 
QuestionInsert Images along with images name to PDF C# Pin
ramyanaidu10-Oct-08 0:43
ramyanaidu10-Oct-08 0:43 
AnswerRe: Insert Images along with images name to PDF C# Pin
leppie10-Oct-08 2:30
leppie10-Oct-08 2:30 
GeneralDesign a Class Pin
Rohit16db10-Oct-08 0:43
Rohit16db10-Oct-08 0:43 
GeneralRe: Design a Class Pin
DaveyM6910-Oct-08 1:29
professionalDaveyM6910-Oct-08 1:29 

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.