Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. .NET (Core and Framework)
  4. Bugs founded

Bugs founded

Scheduled Pinned Locked Moved .NET (Core and Framework)
helpcsharpquestion
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    Hendrik Debedts
    wrote on last edited by
    #1

    Dim oBitArray1 As System.Collections.BitArray oBitArray1 = New System.Collections.BitArray(4) oBitArray1(0) = False oBitArray1(1) = True oBitArray1(2) = True oBitArray1(3) = False Dim oBitArray2 As System.Collections.BitArray oBitArray2 = New System.Collections.BitArray(4) oBitArray2(0) = True oBitArray2(1) = False oBitArray2(2) = True oBitArray2(3) = False Dim oBitArrayOR As System.Collections.BitArray oBitArrayOR = oBitArray1.Or(oBitArray2) 'This changes the content of oBitArray1. Bug? (.Net 2.0) '---------------------------------------------------------------------------------------------------------------- '| Conversion from string "" to type 'Double' is not valid. Why? | '---------------------------------------------------------------------------------------------------------------- '|Bug | '|--- | '|You cannot use a '+=' to concatenate a string with an integer because it wants sum the values and | '|therefore it tries to parse the string to a double. | '|Solution: always use '&=' to concatenate with strings. | '---------------------------------------------------------------------------------------------------------------- For i As Integer = 0 To oBitArrayOR.Count - 1 TextBox1.Text += i'oBitArray1(i) + " OR " + oBitArray2(i) + " = " + oBitArrayXOR(i) + "\r\n" Next BUT Dim x As Integer Dim s As String = s x = 1 x += 3 s += x TextBox1.Text = x & " " & s <-- No exception TextBox1.Text += x <-- Exception TextBox1.Text += x & " " & s <-- No exception So, concatenating two strings with '+=' is no problem

    D 1 Reply Last reply
    0
    • H Hendrik Debedts

      Dim oBitArray1 As System.Collections.BitArray oBitArray1 = New System.Collections.BitArray(4) oBitArray1(0) = False oBitArray1(1) = True oBitArray1(2) = True oBitArray1(3) = False Dim oBitArray2 As System.Collections.BitArray oBitArray2 = New System.Collections.BitArray(4) oBitArray2(0) = True oBitArray2(1) = False oBitArray2(2) = True oBitArray2(3) = False Dim oBitArrayOR As System.Collections.BitArray oBitArrayOR = oBitArray1.Or(oBitArray2) 'This changes the content of oBitArray1. Bug? (.Net 2.0) '---------------------------------------------------------------------------------------------------------------- '| Conversion from string "" to type 'Double' is not valid. Why? | '---------------------------------------------------------------------------------------------------------------- '|Bug | '|--- | '|You cannot use a '+=' to concatenate a string with an integer because it wants sum the values and | '|therefore it tries to parse the string to a double. | '|Solution: always use '&=' to concatenate with strings. | '---------------------------------------------------------------------------------------------------------------- For i As Integer = 0 To oBitArrayOR.Count - 1 TextBox1.Text += i'oBitArray1(i) + " OR " + oBitArray2(i) + " = " + oBitArrayXOR(i) + "\r\n" Next BUT Dim x As Integer Dim s As String = s x = 1 x += 3 s += x TextBox1.Text = x & " " & s <-- No exception TextBox1.Text += x <-- Exception TextBox1.Text += x & " " & s <-- No exception So, concatenating two strings with '+=' is no problem

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      So, is there is question in this, or what? There are no bugs with these operators. The '&' and '+' operators are fully documented here[^] in the VB.NET Language Concepts reference. If you use the '+' operator to concatenate strings and numbers, you have to beware of the implicit conversions involved when using it, all of which are documented here[^]. If you use the '&' operator, any operands that are not already Strings are always converted to Strings before the concatenation takes place.

      Dave Kreskowiak Microsoft MVP - Visual Basic

      T 1 Reply Last reply
      0
      • D Dave Kreskowiak

        So, is there is question in this, or what? There are no bugs with these operators. The '&' and '+' operators are fully documented here[^] in the VB.NET Language Concepts reference. If you use the '+' operator to concatenate strings and numbers, you have to beware of the implicit conversions involved when using it, all of which are documented here[^]. If you use the '&' operator, any operands that are not already Strings are always converted to Strings before the concatenation takes place.

        Dave Kreskowiak Microsoft MVP - Visual Basic

        T Offline
        T Offline
        Tal Kain
        wrote on last edited by
        #3

        I just want to comment that you can also create your own implementation for the operators in your classes... Here is a tutorial I found by using Google: Here[^] other tutorials can be found over Here[^]

        D 1 Reply Last reply
        0
        • T Tal Kain

          I just want to comment that you can also create your own implementation for the operators in your classes... Here is a tutorial I found by using Google: Here[^] other tutorials can be found over Here[^]

          D Offline
          D Offline
          Dave Kreskowiak
          wrote on last edited by
          #4

          Don't tell me that, tell the OP!

          Dave Kreskowiak Microsoft MVP - Visual Basic

          T 1 Reply Last reply
          0
          • D Dave Kreskowiak

            Don't tell me that, tell the OP!

            Dave Kreskowiak Microsoft MVP - Visual Basic

            T Offline
            T Offline
            Tal Kain
            wrote on last edited by
            #5

            Hehe, I just replyed to the wrong messege... sorry ;-)

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups