Code optimization...

Ask a Question related to ASP.NET General, Design and Development.

  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.Parse(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" <raphael@desalbres.com> wrote in message
    news:ePf8jywQDHA.3880@tk2msftngp13.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. Similar Questions and Discussions

    1. pdf optimization
      how to optimize pdf doc in c#
    2. FMS - video optimization
      Hello, I'm currently writing an application which going to broadcast LIVE video from about 30-40 broadcaster. The application is going to use...
    3. 3D optimization
      HI All, I've made a 3D environment in lingo with Director MX, which uses some Havok physics - not much at the moment as I was concentrating on...
    4. Index optimization ?
      Hi ... In my quest to get rid of the oid dependency, i have made some new low level code with the help from many nice people from this community...
    5. Looking for Optimization
      hiya I'd like to optimize a code snippet I wrote: ------------------------------------------------------------------------ while ($Girl =...
  3. #2

    Default Re: Code optimization...

    Thanks very much for your reply, Peter...

    Sincerely,

    Raphaël Désalbres


    "Pete Wright" <pete@codemonkey.demon.co.uk> escreveu na mensagem
    news:be70io$8t1$1$8300dec7@news.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.Parse(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" <raphael@desalbres.com> wrote in message
    > news:ePf8jywQDHA.3880@tk2msftngp13.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

  4. #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" <pete@codemonkey.demon.co.uk> wrote in message
    news:be70io$8t1$1$8300dec7@news.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.Parse(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" <raphael@desalbres.com> wrote in message
    > news:ePf8jywQDHA.3880@tk2msftngp13.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

Posting Permissions

  • You may not post new threads
  • You may 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