Hi,
I'm not an MVP but I can answer this for you. If you are just using it 5
times you will not notice much of a performance boost by putting it into a
variable. However, if you were using this in a loop that had a ton of
iterations you would see a *small* gain in performance. Also it looks like
your GetProductInfoX () functions take an Integer. So by doing this:
Dim int as Integer
int = CInt(ddl.Select edItem.Value)
And then using int in your function calls you will also increase performance
because the CLR won't have to perform the conversion 5 times. Again, since
it is only used 5 times the performance will hardly be measurable. But if
this was in a loop then the conversion for each iteration would cost you a
little bit.
By putting Option Strict On at the beginning of each code file you will see
where the CLR is doing all your conversions for you. If they are in loops
then doing the conversion yourself and using the result will optimize your
code. It could also help you catch tricky errors that occur when the CLR
tries to figure out what your trying to do but gets it wrong. Good luck!
Ken.
--
Ken Dopierala Jr.
For great ASP.Net web hosting try:
http://www.webhost4life.com/default.asp?refid=Spinlight
"Asha" <As**@discussio ns.microsoft.co m> wrote in message
news:DC******** *************** ***********@mic rosoft.com...
Dear MVP,
A small question to you all
Lets say I have an application which gets the value from a drop down list,
e.g.
GetProductInfo1 (ddl.selectedIt em.value)
GetProductInfo2 (ddl.selectedIt em.value)
GetProductInfo3 (ddl.selectedIt em.value)
GetProductInfo4 (ddl.selectedIt em.value)
GetProductInfo5 (ddl.selectedIt em.value)
If you notice, I'm repeating ddl.selectedIte m.value 5 times, would it be
better if I just put it into a variable e.g.
Dim int as integer
Int = ddl.selectedIte m.value
And from there I just use the variable when ever I need it, rather then
having it call this stmt ddl.selectedIte m.value. would it improve
performance?
Thanks for taking the time to read this post.