Click here to Skip to main content
15,908,581 members
Home / Discussions / Visual Basic
   

Visual Basic

 
QuestionDateTimePicker Pin
vijay24822-Feb-09 21:45
vijay24822-Feb-09 21:45 
AnswerRe: DateTimePicker Pin
Rupesh Kumar Swami2-Feb-09 22:32
Rupesh Kumar Swami2-Feb-09 22:32 
GeneralRe: DateTimePicker [modified] Pin
vijay24822-Feb-09 23:03
vijay24822-Feb-09 23:03 
QuestionModifying user defined structures in a collection Pin
Jay Royall2-Feb-09 21:43
Jay Royall2-Feb-09 21:43 
AnswerRe: Modifying user defined structures in a collection Pin
Tony Richards2-Feb-09 23:47
Tony Richards2-Feb-09 23:47 
GeneralRe: Modifying user defined structures in a collection Pin
Jay Royall2-Feb-09 23:59
Jay Royall2-Feb-09 23:59 
GeneralRe: Modifying user defined structures in a collection Pin
supercat93-Feb-09 6:04
supercat93-Feb-09 6:04 
GeneralRe: Modifying user defined structures in a collection Pin
Guffa3-Feb-09 13:51
Guffa3-Feb-09 13:51 
Liqz wrote:

I didn't want to classes because it seemed to be overkill considering my structures only contain 3 maybe 4 properties.


As you are casting the values, I suppose that you are using an untyped collection like ArrayList? In that case, there is no benefit at all using a structure, as each structure value will be boxed inside an object in order for the collection to be able to handle it.

That also means that it's impossible to change the separate properties in place. The value has to be unboxed and copied to a variable, where you can change the property, then the value can be boxed and stored back in the collection.

Liqz wrote:
So I thought structures would be more appropriate.


No, that's not a good reason to use a structure. A structure is used when you want value type semantics, but what you have clearly contains several distinct values. Usually a structure is immutable, which means that you don't change a separate property. If you want a different set of properties you create a new structure value.

In this case you should definitely use a class instead. Unless you have a specific reason to use a structure, a class should always be the first choise. A structure can be more efficitent in some cases, but then it's also harder to implement it so that it works properly.

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

GeneralRe: Modifying user defined structures in a collection Pin
Jay Royall3-Feb-09 22:06
Jay Royall3-Feb-09 22:06 
GeneralRe: Modifying user defined structures in a collection Pin
Jay Royall3-Feb-09 2:21
Jay Royall3-Feb-09 2:21 
QuestionI would love to learn how to use my compiler.. It is of a strange new language to will anyone volenteer to help teach me ? Pin
sweldon0012-Feb-09 19:48
sweldon0012-Feb-09 19:48 
AnswerRe: I would love to learn how to use my compiler.. It is of a strange new language to will anyone volenteer to help teach me ? Pin
Jay Royall2-Feb-09 21:51
Jay Royall2-Feb-09 21:51 
AnswerRe: I would love to learn how to use my compiler.. It is of a strange new language to will anyone volenteer to help teach me ? Pin
EliottA3-Feb-09 2:39
EliottA3-Feb-09 2:39 
Questionclear variables Pin
aswd2-Feb-09 18:12
aswd2-Feb-09 18:12 
AnswerRe: clear variables Pin
MohammadAmiry2-Feb-09 18:22
MohammadAmiry2-Feb-09 18:22 
GeneralRe: clear variables Pin
aswd2-Feb-09 18:26
aswd2-Feb-09 18:26 
GeneralRe: clear variables Pin
Dave Kreskowiak2-Feb-09 18:36
mveDave Kreskowiak2-Feb-09 18:36 
GeneralRe: clear variables Pin
aswd2-Feb-09 18:41
aswd2-Feb-09 18:41 
GeneralRe: clear variables Pin
Christian Graus2-Feb-09 19:18
protectorChristian Graus2-Feb-09 19:18 
GeneralRe: clear variables Pin
aswd2-Feb-09 19:28
aswd2-Feb-09 19:28 
GeneralRe: clear variables Pin
Dave Kreskowiak3-Feb-09 1:47
mveDave Kreskowiak3-Feb-09 1:47 
GeneralRe: clear variables Pin
EliottA3-Feb-09 2:34
EliottA3-Feb-09 2:34 
GeneralRe: clear variables Pin
Guffa4-Feb-09 1:02
Guffa4-Feb-09 1:02 
QuestionDifferent Indian Languages in Textbox Pin
harsh_c2-Feb-09 18:12
professionalharsh_c2-Feb-09 18:12 
AnswerRe: Different Indian Languages in Textbox Pin
Dave Kreskowiak2-Feb-09 18:37
mveDave Kreskowiak2-Feb-09 18: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.