Click here to Skip to main content
15,893,564 members
Home / Discussions / C#
   

C#

 
QuestionC# and null Structs? Pin
Rodney S. Foley27-Aug-02 18:01
Rodney S. Foley27-Aug-02 18:01 
AnswerRe: C# and null Structs? Pin
James T. Johnson27-Aug-02 18:18
James T. Johnson27-Aug-02 18:18 
GeneralRe: C# and null Structs? Pin
Rodney S. Foley27-Aug-02 18:47
Rodney S. Foley27-Aug-02 18:47 
GeneralRe: C# and null Structs? Pin
leppie27-Aug-02 21:33
leppie27-Aug-02 21:33 
GeneralRe: C# and null Structs? Pin
Rodney S. Foley28-Aug-02 8:18
Rodney S. Foley28-Aug-02 8:18 
GeneralRe: C# and null Structs? Pin
leppie28-Aug-02 8:52
leppie28-Aug-02 8:52 
AnswerRe: C# and null Structs? Pin
Alastair Stell27-Aug-02 21:52
Alastair Stell27-Aug-02 21:52 
GeneralRe: C# and null Structs? Pin
Rodney S. Foley28-Aug-02 7:50
Rodney S. Foley28-Aug-02 7:50 
Casting a sturct to an object is to much overhead. I would have to cast it every time it is needed. Thanks for the advice though.

All structs in the .NET Framework seem to have ways around this problem, by providing a static EMPTY member that you use like setting an object to null, and an IsEmpty property for testing against like testing against a null object. Only have to worry about 3rd party structs. I do not create structs in my code, since I do not like them. I use classes not structs.

In my opinion the only useful struct is one that does not have constructors or methods, just public members for use a simple data structure. To do more than this, you should just design it as a class not a struct. Struct's are from pre-OOD, and they should not have been brought into a new OO language. They have reasons for being in C++ for backwards compatibility, but they have no usefulness in C#.

Again this is just more of my ranting about a bad design choice on Microsoft part.

Aalst
GeneralRe: C# and null Structs? Pin
Alastair Stell29-Aug-02 4:48
Alastair Stell29-Aug-02 4:48 
GeneralRe: C# and null Structs? Pin
Rodney S. Foley29-Aug-02 9:49
Rodney S. Foley29-Aug-02 9:49 
GeneralCPropertySheet Pin
candan27-Aug-02 17:11
professionalcandan27-Aug-02 17:11 
GeneralRe: CPropertySheet Pin
James T. Johnson27-Aug-02 17:52
James T. Johnson27-Aug-02 17:52 
GeneralRe: CPropertySheet Pin
candan27-Aug-02 20:06
professionalcandan27-Aug-02 20:06 
GeneralRe: CPropertySheet Pin
James T. Johnson27-Aug-02 20:11
James T. Johnson27-Aug-02 20:11 
GeneralRe: CPropertySheet Pin
leppie27-Aug-02 21:42
leppie27-Aug-02 21:42 
GeneralJames, how do i upload? Pin
leppie27-Aug-02 22:00
leppie27-Aug-02 22:00 
GeneralRe: James, how do i upload? Pin
Mazdak27-Aug-02 22:23
Mazdak27-Aug-02 22:23 
GeneralRe: James, how do i upload? Pin
James T. Johnson28-Aug-02 6:06
James T. Johnson28-Aug-02 6:06 
GeneralMouse Capture Pin
Alex Korchemniy27-Aug-02 15:12
Alex Korchemniy27-Aug-02 15:12 
GeneralRe: Mouse Capture Pin
Alastair Stell27-Aug-02 17:04
Alastair Stell27-Aug-02 17:04 
GeneralError when converting to use UDP Pin
Luis Alonso Ramos27-Aug-02 14:34
Luis Alonso Ramos27-Aug-02 14:34 
GeneralRe: Error when converting to use UDP Pin
Michael Mac28-Aug-02 2:15
Michael Mac28-Aug-02 2:15 
GeneralRe: Error when converting to use UDP Pin
Luis Alonso Ramos28-Aug-02 3:04
Luis Alonso Ramos28-Aug-02 3:04 
GeneralRe: Error when converting to use UDP Pin
Michael Mac28-Aug-02 3:51
Michael Mac28-Aug-02 3:51 
GeneralRe: Error when converting to use UDP Pin
Luis Alonso Ramos28-Aug-02 4:14
Luis Alonso Ramos28-Aug-02 4:14 

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.