Which is faster? Dim dv As New DataView(session("myDataTable")) or CType(session("myDataTable"))

Discussion in 'ASP .Net' started by Andreas Klemt, Jul 23, 2003.

  1. Hello,
    let's say my session("myDataTable") is type of DataTable

    Now what is faster?

    a) Dim dv As New DataView(session("myDataTable"))
    b) Dim dv As New DataView(CType(session("myDataTable"), DataTable))

    Which should I use and which is better?


    Thanks in advance,
    Andreas
    Andreas Klemt, Jul 23, 2003
    #1
    1. Advertising

  2. They are both equivalent because the conversion happens whether you specify
    it or not.
    If you have Option Strict turned on (which every good programmer should)
    then only your second example will work anyway so the subject becomes moot.
    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vblr7/html/vastmOptionStrict.asp

    --
    I hope this helps,
    Steve C. Orr, MCSD
    http://Steve.Orr.net


    "Andreas Klemt" <> wrote in message
    news:...
    > Hello,
    > let's say my session("myDataTable") is type of DataTable
    >
    > Now what is faster?
    >
    > a) Dim dv As New DataView(session("myDataTable"))
    > b) Dim dv As New DataView(CType(session("myDataTable"), DataTable))
    >
    > Which should I use and which is better?
    >
    >
    > Thanks in advance,
    > Andreas
    >
    >
    Steve C. Orr, MCSD, Jul 23, 2003
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Denis Palas
    Replies:
    1
    Views:
    491
  2. CodeMonkey
    Replies:
    1
    Views:
    715
    joyal jhaveri
    Feb 4, 2011
  3. decker
    Replies:
    9
    Views:
    316
    Barry Schwarz
    Nov 10, 2007
  4. Florian Kaufmann
    Replies:
    1
    Views:
    367
  5. Replies:
    3
    Views:
    172
Loading...

Share This Page