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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. Array.resize

Array.resize

Scheduled Pinned Locked Moved C#
csharpdotnetvisual-studiocomdata-structures
5 Posts 4 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.
  • C Offline
    C Offline
    C NewBe
    wrote on last edited by
    #1

    Note: This method is new in the .NET Framework version 2.0. and I am using .NET Framework version 2.0.50727. http://msdn.microsoft.com/en-us/library/1ffy6686(VS.80).aspx Array.Resize(ref m_yData, m_points); I get this compile error message "'System.Array' does not contain a definition for 'Resize'".....What am I missing or doing wrong? Thanks

    L realJSOPR 2 Replies Last reply
    0
    • C C NewBe

      Note: This method is new in the .NET Framework version 2.0. and I am using .NET Framework version 2.0.50727. http://msdn.microsoft.com/en-us/library/1ffy6686(VS.80).aspx Array.Resize(ref m_yData, m_points); I get this compile error message "'System.Array' does not contain a definition for 'Resize'".....What am I missing or doing wrong? Thanks

      L Offline
      L Offline
      led mike
      wrote on last edited by
      #2

      C++NewBe wrote:

      What am I missing or doing wrong?

      It's a Generic method so you need a type initializer. The example code in the documentation appears to be wrong also.

      int[] ints = { 1, 2, 3 };
      Array.Resize<int>(ref ints, 5);

      led mike

      D 1 Reply Last reply
      0
      • C C NewBe

        Note: This method is new in the .NET Framework version 2.0. and I am using .NET Framework version 2.0.50727. http://msdn.microsoft.com/en-us/library/1ffy6686(VS.80).aspx Array.Resize(ref m_yData, m_points); I get this compile error message "'System.Array' does not contain a definition for 'Resize'".....What am I missing or doing wrong? Thanks

        realJSOPR Offline
        realJSOPR Offline
        realJSOP
        wrote on last edited by
        #3

        Use a collection instead of an arraylist. Then you don't have to resize manually.

        "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997
        -----
        "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001

        1 Reply Last reply
        0
        • L led mike

          C++NewBe wrote:

          What am I missing or doing wrong?

          It's a Generic method so you need a type initializer. The example code in the documentation appears to be wrong also.

          int[] ints = { 1, 2, 3 };
          Array.Resize<int>(ref ints, 5);

          led mike

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

          You don't need to specify the generic type for a generic method call - you can do this, but in most cases the compiler is smart enough to figure it out. Explicitly specifying the generic type in a method call is only necessary in ambiguous cases where the compiler can't compute the type. e.g., Array.Resize(ref ints, 5); will work just fine.

          David Anton http://www.tangiblesoftwaresolutions.com C++ to C# Converter C++ to VB Converter C++ to Java Converter VB to Java Converter Java to VB & C# Converter Instant C#: VB to C# converter Instant VB: C# to VB converter Instant C++: convert VB, C#, or Java to C++/CLI

          L 1 Reply Last reply
          0
          • D Dave Doknjas

            You don't need to specify the generic type for a generic method call - you can do this, but in most cases the compiler is smart enough to figure it out. Explicitly specifying the generic type in a method call is only necessary in ambiguous cases where the compiler can't compute the type. e.g., Array.Resize(ref ints, 5); will work just fine.

            David Anton http://www.tangiblesoftwaresolutions.com C++ to C# Converter C++ to VB Converter C++ to Java Converter VB to Java Converter Java to VB & C# Converter Instant C#: VB to C# converter Instant VB: C# to VB converter Instant C++: convert VB, C#, or Java to C++/CLI

            L Offline
            L Offline
            led mike
            wrote on last edited by
            #5

            David Anton wrote:

            You don't need to specify the generic type for a generic method call - you can do this, but in most cases the compiler is smart enough to figure it out. Explicitly specifying the generic type in a method call is only necessary in ambiguous cases where the compiler can't compute the type.

            Sweet. Missed that one and it makes a huge difference. :beer:

            led mike

            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