A Small .NET Rant

Author Message
TNO

  • Total Posts : 2094
  • Scores: 36
  • Reward points : 0
  • Joined: 12/18/2004
  • Location: Earth
  • Status: offline
A Small .NET Rant Wednesday, November 26, 2008 9:34 AM (permalink)
0
 Dim MyList As New List(Of Stuff)
 
 Public Sub RemoveItem(ByValID As String)
       For Each Item As MyItem In MyList
             If Item.ItemID = ID Then
                   MyList.Remove(Item)
             End If
       Next 'Iteration Error is Thrown here because the number of items in the list changed
 End Sub


God forbid I have more than one item in the list with that ID I want to remove.... Why oh why doesn't .NET support live list updates? Having to Copy everything that fails the test into a new List and overwriting the original is retarded.
To iterate is human, to recurse divine. -- L. Peter Deutsch
 
#1
    ebgreen

    • Total Posts : 8219
    • Scores: 98
    • Reward points : 0
    • Joined: 7/12/2005
    • Status: offline
    RE: A Small .NET Rant Wednesday, November 26, 2008 9:39 AM (permalink)
    0
    Using a generic collection would alleviate this.
    "... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
    Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
    http://www.visualbasicscript.com/m_47117/tm.htm
     
    #2
      TNO

      • Total Posts : 2094
      • Scores: 36
      • Reward points : 0
      • Joined: 12/18/2004
      • Location: Earth
      • Status: offline
      RE: A Small .NET Rant Tuesday, December 02, 2008 4:21 AM (permalink)
      0
      Heres another rant.

      I recently tried to bind a dataset to a radiobuttonlist with an edit button control inside the datatext area. (choose a shipping address with a button to edit it). THe hoops you have to jump through are more than you would expect.

      #1- A RadioButton list only allows textual content in the datatext field when binding.
      #2 - So I used a repeater instead to generate singular radio buttons with a button control dynamically added. Everything ok thus far. and I gave everything the same GroupName
            .NET destroys and replaces your groupname attributes so my radio buttons are no longer related to each other...
      #3 - I finally said screw it I'll generate a panel with everything in it in memory by looping through the dataset in a loop. (another hitch with this was that there is no such thing an html control for a span. you have to create a generic control.)
      #4 - So finally I get through all of that and insert it into the page (which is in a user control). And then oops. All my button events no longer recognize the controls due to how events wire up in .NET.....

      ....

      Luckily I figured out how to use the onbubble method to generically capture page events and then Duck Type them to recognize my controls and get them  to do what I needed. So much effort for so little...

      Friends don't let friends use .NET
      To iterate is human, to recurse divine. -- L. Peter Deutsch
       
      #3
        TNO

        • Total Posts : 2094
        • Scores: 36
        • Reward points : 0
        • Joined: 12/18/2004
        • Location: Earth
        • Status: offline
        RE: A Small .NET Rant Tuesday, December 02, 2008 5:19 AM (permalink)
        0
        VB.NET supports this

        i+=1


        But not this

        i++


        Am I the only one who thinks that doesn't make any sense?

        I guess my small rant isn't as small as I thought it was going to be
        To iterate is human, to recurse divine. -- L. Peter Deutsch
         
        #4

          Online Bookmarks Sharing: Share/Bookmark

          Jump to:

          Current active users

          There are 0 members and 1 guests.

          Icon Legend and Permission

          • New Messages
          • No New Messages
          • Hot Topic w/ New Messages
          • Hot Topic w/o New Messages
          • Locked w/ New Messages
          • Locked w/o New Messages
          • Read Message
          • Post New Thread
          • Reply to message
          • Post New Poll
          • Submit Vote
          • Post reward post
          • Delete my own posts
          • Delete my own threads
          • Rate post

          2000-2012 ASPPlayground.NET Forum Version 3.9