Professional Web Applications Themes

Code optimization... - ASP.NET General

This is a trick question right? I mean, you know that there is only one element in the rsc.SelectedIndexes, so how would you optimize the loop. Ok, well, on the off-chance that it's not a trick question (and, BTW, Index = selectedIndex.ToString will never work, since Index is an integer and ToString() returns a string, but anyway.... Dim Index as Integer Index = Int32.P(rsc.SelectedIndexes(1)) There yah go - I am of course assuming that the index of the one item in the array is item number 1. -- Peter Wright Author of ADO.NET Novice To Pro, from Apress Inc. "RaphaŽl ...

  1. #1

    Default Re: Code optimization...

    This is a trick question right? I mean, you know that there is only one
    element in the rsc.SelectedIndexes, so how would you optimize the loop.

    Ok, well, on the off-chance that it's not a trick question (and, BTW, Index
    = selectedIndex.ToString will never work, since Index is an integer and
    ToString() returns a string, but anyway....

    Dim Index as Integer
    Index = Int32.P(rsc.SelectedIndexes(1))

    There yah go - I am of course assuming that the index of the one item in the
    array is item number 1.
    --
    Peter Wright
    Author of ADO.NET Novice To Pro, from Apress Inc.


    "RaphaŽl Dťsalbres" <raphaeldesalbres.com> wrote in message
    news:ePf8jywQDHA.3880tk2msftngp13.phx.gbl...
    > Hello,
    >
    > I would like to optimize the following code, knowing that there is only
    one
    > element in SelectedIndexes.
    >
    > Dim selectedIndex, Index As Integer
    > For Each selectedIndex In rsc.SelectedIndexes
    > Index = selectedIndex.ToString
    > Next
    >
    > Thanks,
    >
    > RaphaŽl Dťsalbres
    >
    >
    >

    Pete Wright Guest

  2. #2

    Default Re: Code optimization...

    Thanks very much for your reply, Peter...

    Sincerely,

    RaphaŽl Dťsalbres


    "Pete Wright" <petecodemonkey.demon.co.uk> escreveu na mensagem
    news:be70io$8t1$1$8300dec7news.demon.co.uk...
    > This is a trick question right? I mean, you know that there is only one
    > element in the rsc.SelectedIndexes, so how would you optimize the loop.
    >
    > Ok, well, on the off-chance that it's not a trick question (and, BTW,
    Index
    > = selectedIndex.ToString will never work, since Index is an integer and
    > ToString() returns a string, but anyway....
    >
    > Dim Index as Integer
    > Index = Int32.P(rsc.SelectedIndexes(1))
    >
    > There yah go - I am of course assuming that the index of the one item in
    the
    > array is item number 1.
    > --
    > Peter Wright
    > Author of ADO.NET Novice To Pro, from Apress Inc.
    >
    >
    > "RaphaŽl Dťsalbres" <raphaeldesalbres.com> wrote in message
    > news:ePf8jywQDHA.3880tk2msftngp13.phx.gbl...
    > > Hello,
    > >
    > > I would like to optimize the following code, knowing that there is only
    > one
    > > element in SelectedIndexes.
    > >
    > > Dim selectedIndex, Index As Integer
    > > For Each selectedIndex In rsc.SelectedIndexes
    > > Index = selectedIndex.ToString
    > > Next
    > >
    > > Thanks,
    > >
    > > RaphaŽl Dťsalbres
    > >
    > >
    > >
    >
    >

    RaphaŽl Dťsalbres Guest

  3. #3

    Default Re: Code optimization...

    but, only two problems here

    first, that's why there's a .ToString method - to convert the integer to
    string, so that will work.

    and secondly, the index, i believe, is ZERO based:
    rcs.SelectedIndexes(0)

    and finally, what ASPX control has a SelectedIndexes collection in the first
    place? I don't recall any.
    There are 3rd party controls that use this, but ASPX???


    Pete, I think this WAS a trick question! :-)


    "Pete Wright" <petecodemonkey.demon.co.uk> wrote in message
    news:be70io$8t1$1$8300dec7news.demon.co.uk...
    > This is a trick question right? I mean, you know that there is only one
    > element in the rsc.SelectedIndexes, so how would you optimize the loop.
    >
    > Ok, well, on the off-chance that it's not a trick question (and, BTW,
    Index
    > = selectedIndex.ToString will never work, since Index is an integer and
    > ToString() returns a string, but anyway....
    >
    > Dim Index as Integer
    > Index = Int32.P(rsc.SelectedIndexes(1))
    >
    > There yah go - I am of course assuming that the index of the one item in
    the
    > array is item number 1.
    > --
    > Peter Wright
    > Author of ADO.NET Novice To Pro, from Apress Inc.
    >
    >
    > "RaphaŽl Dťsalbres" <raphaeldesalbres.com> wrote in message
    > news:ePf8jywQDHA.3880tk2msftngp13.phx.gbl...
    > > Hello,
    > >
    > > I would like to optimize the following code, knowing that there is only
    > one
    > > element in SelectedIndexes.
    > >
    > > Dim selectedIndex, Index As Integer
    > > For Each selectedIndex In rsc.SelectedIndexes
    > > Index = selectedIndex.ToString
    > > Next
    > >
    > > Thanks,
    > >
    > > RaphaŽl Dťsalbres
    > >
    > >
    > >
    >
    >

    David Waz... Guest

Similar Threads

  1. Coldfusion Optimization
    By jpilgrim in forum Coldfusion Server Administration
    Replies: 1
    Last Post: December 4th, 02:03 PM
  2. pdf optimization
    By palaksha@adobeforums.com in forum Adobe Acrobat SDK
    Replies: 0
    Last Post: July 18th, 08:01 AM
  3. FMS - video optimization
    By websitesadmin in forum Macromedia Flash Flashcom
    Replies: 1
    Last Post: May 25th, 08:20 PM
  4. 3D optimization
    By DaveRaith in forum Macromedia Director 3D
    Replies: 6
    Last Post: March 20th, 02:06 PM
  5. Looking for Optimization
    By Thomas Neumann in forum PHP Development
    Replies: 1
    Last Post: October 15th, 06:43 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139