Hi all,

More of general question, than just about drop down objects, but that's where I noticed first, so I'm using that as my example.

In the project I am working on, one of the programmers created a new drop down item using

new ListItem() {Text = "stuff", Value="someValue"};

I always used

new ListItem("stuff", "someValue");

Is there a difference or a reason why you would use one over the other? They both seem to end up with the same object. Maybe there is no difference, not really sure. The only reason that I can see it being more helpful is that if you don't know the fields in the way I'm using it, the first way clearly spells it out.

So any thoughts would be great.

Thanks

Croker10

I would say there is no difference, just that the your 1st example shows to which property some value is relied to. But if you know what you are doing, and know code well, its surely better to use 2nd option, which is the same as 1st one, but faster to write (execution time is the same tho).

Okay, thanks for the response. I wasn't sure if there was a performance difference or anything of that nature, but I definitely agree, the less I type, the happier I am!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.